From 18bdb6db2ab2312ef7c53c2b9a2fbbac588c9977 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89amonn=20McManus?= Date: Wed, 15 Feb 2023 05:53:29 -0800 Subject: [PATCH] Fix a couple of types in tests. (#2317) These show up with recent Error Prone analyses for Truth. Because the tests use the overload of `Gson.fromJson` that takes a `Type` argument, rather than the one with a `TypeToken`, the type mismatches were not detected by the compiler. --- gson/src/test/java/com/google/gson/functional/MapTest.java | 2 +- .../java/com/google/gson/functional/ParameterizedTypesTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gson/src/test/java/com/google/gson/functional/MapTest.java b/gson/src/test/java/com/google/gson/functional/MapTest.java index 3dd8e3d8..5b9a7b20 100644 --- a/gson/src/test/java/com/google/gson/functional/MapTest.java +++ b/gson/src/test/java/com/google/gson/functional/MapTest.java @@ -301,7 +301,7 @@ public class MapTest { public void testMapStandardSubclassDeserialization() { String json = "{a:'1',b:'2'}"; Type type = new TypeToken>() {}.getType(); - LinkedHashMap map = gson.fromJson(json, type); + LinkedHashMap map = gson.fromJson(json, type); assertThat(map).containsEntry("a", "1"); assertThat(map).containsEntry("b", "2"); } diff --git a/gson/src/test/java/com/google/gson/functional/ParameterizedTypesTest.java b/gson/src/test/java/com/google/gson/functional/ParameterizedTypesTest.java index 55b93839..53bb6f77 100644 --- a/gson/src/test/java/com/google/gson/functional/ParameterizedTypesTest.java +++ b/gson/src/test/java/com/google/gson/functional/ParameterizedTypesTest.java @@ -161,7 +161,7 @@ public class ParameterizedTypesTest { .create(); Reader json = new StringReader(expected.getExpectedJson()); - MyParameterizedType actual = gson.fromJson(json, expectedType); + MyParameterizedType actual = gson.fromJson(json, expectedType); assertThat(actual).isEqualTo(expected); }