Skip to content

Commit 921bbb4

Browse files
committed
Adjust tests
1 parent 1f496d7 commit 921bbb4

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

gson/src/test/java/com/google/gson/GsonTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ public String toString() {
175175
+ " but got instance of class java.lang.Integer\n"
176176
+ "Verify that the adapter was registed for the correct type.");
177177

178-
// Returning boxed object should be allowed (e.g. returning `Integer` for `int`)
178+
// Returning boxed primitive should be allowed (e.g. returning `Integer` for `int`)
179179
Gson gson2 = new GsonBuilder().registerTypeAdapter(int.class, new IntegerAdapter()).create();
180180
assertThat(gson2.fromJson("0", int.class)).isEqualTo(3);
181181

gson/src/test/java/com/google/gson/internal/ConstructorConstructorTest.java

+2-6
Original file line numberDiff line numberDiff line change
@@ -179,16 +179,12 @@ public void testStringMapCreation() {
179179

180180
// But when explicitly requesting a `LinkedHashMap<String, ...>` should use JDK `LinkedHashMap`
181181
actual =
182-
constructorConstructor
183-
.get(TypeToken.getParameterized(LinkedHashMap.class, String.class, Integer.class))
184-
.construct();
182+
constructorConstructor.get(new TypeToken<LinkedHashMap<String, Integer>>() {}).construct();
185183
assertThat(actual).isInstanceOf(LinkedHashMap.class);
186184

187185
// For all Map types with non-String key, should use JDK `LinkedHashMap` by default
188186
actual =
189-
constructorConstructor
190-
.get(TypeToken.getParameterized(Map.class, Integer.class, Integer.class))
191-
.construct();
187+
constructorConstructor.get(new TypeToken<LinkedHashMap<Integer, Integer>>() {}).construct();
192188
assertThat(actual).isInstanceOf(LinkedHashMap.class);
193189
}
194190

0 commit comments

Comments
 (0)