From d38e3974211e89d8e6d74c94178a2db102c0748d Mon Sep 17 00:00:00 2001 From: Marcono1234 Date: Mon, 10 Jan 2022 16:18:42 +0100 Subject: [PATCH] Fix ObjectTest not restoring default Locale (#2050) --- .../test/java/com/google/gson/functional/ObjectTest.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gson/src/test/java/com/google/gson/functional/ObjectTest.java b/gson/src/test/java/com/google/gson/functional/ObjectTest.java index 48508f83..9fcbd311 100644 --- a/gson/src/test/java/com/google/gson/functional/ObjectTest.java +++ b/gson/src/test/java/com/google/gson/functional/ObjectTest.java @@ -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);