Revised the setup for date/time tests to use PST time-zone. This fixes bug 184 by ensuring that tests are run in PST time-zone.

This commit is contained in:
Inderjeet Singh 2010-01-08 18:53:39 +00:00
parent c5e3c32215
commit 058f7344db

View File

@ -36,6 +36,7 @@ import java.util.HashSet;
import java.util.Locale; import java.util.Locale;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import java.util.TimeZone;
import java.util.UUID; import java.util.UUID;
/** /**
@ -47,13 +48,22 @@ import java.util.UUID;
*/ */
public class DefaultTypeAdaptersTest extends TestCase { public class DefaultTypeAdaptersTest extends TestCase {
private Gson gson; private Gson gson;
private TimeZone oldTimeZone;
@Override @Override
protected void setUp() throws Exception { protected void setUp() throws Exception {
super.setUp(); super.setUp();
this.oldTimeZone = TimeZone.getDefault();
TimeZone.setDefault(TimeZone.getTimeZone("PST"));
gson = new Gson(); gson = new Gson();
} }
@Override
protected void tearDown() throws Exception {
TimeZone.setDefault(oldTimeZone);
super.tearDown();
}
public void testUrlSerialization() throws Exception { public void testUrlSerialization() throws Exception {
String urlValue = "http://google.com/"; String urlValue = "http://google.com/";
URL url = new URL(urlValue); URL url = new URL(urlValue);