Fix ObjectTest not restoring default Locale (#2050)
This commit is contained in:
parent
4ec67c00a0
commit
d38e397421
@ -55,22 +55,27 @@ import junit.framework.TestCase;
|
||||
*/
|
||||
public class ObjectTest extends TestCase {
|
||||
private Gson gson;
|
||||
private TimeZone oldTimeZone = TimeZone.getDefault();
|
||||
private TimeZone oldTimeZone;
|
||||
private Locale oldLocale;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
gson = new Gson();
|
||||
|
||||
oldTimeZone = TimeZone.getDefault();
|
||||
TimeZone.setDefault(TimeZone.getTimeZone("America/Los_Angeles"));
|
||||
oldLocale = Locale.getDefault();
|
||||
Locale.setDefault(Locale.US);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
TimeZone.setDefault(oldTimeZone);
|
||||
Locale.setDefault(oldLocale);
|
||||
super.tearDown();
|
||||
}
|
||||
|
||||
public void testJsonInSingleQuotesDeserialization() {
|
||||
String json = "{'stringValue':'no message','intValue':10,'longValue':20}";
|
||||
BagOfPrimitives target = gson.fromJson(json, BagOfPrimitives.class);
|
||||
|
Loading…
Reference in New Issue
Block a user