File tree 2 files changed +3
-7
lines changed
gson/src/test/java/com/google/gson
2 files changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -175,7 +175,7 @@ public String toString() {
175
175
+ " but got instance of class java.lang.Integer\n "
176
176
+ "Verify that the adapter was registed for the correct type." );
177
177
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`)
179
179
Gson gson2 = new GsonBuilder ().registerTypeAdapter (int .class , new IntegerAdapter ()).create ();
180
180
assertThat (gson2 .fromJson ("0" , int .class )).isEqualTo (3 );
181
181
Original file line number Diff line number Diff line change @@ -179,16 +179,12 @@ public void testStringMapCreation() {
179
179
180
180
// But when explicitly requesting a `LinkedHashMap<String, ...>` should use JDK `LinkedHashMap`
181
181
actual =
182
- constructorConstructor
183
- .get (TypeToken .getParameterized (LinkedHashMap .class , String .class , Integer .class ))
184
- .construct ();
182
+ constructorConstructor .get (new TypeToken <LinkedHashMap <String , Integer >>() {}).construct ();
185
183
assertThat (actual ).isInstanceOf (LinkedHashMap .class );
186
184
187
185
// For all Map types with non-String key, should use JDK `LinkedHashMap` by default
188
186
actual =
189
- constructorConstructor
190
- .get (TypeToken .getParameterized (Map .class , Integer .class , Integer .class ))
191
- .construct ();
187
+ constructorConstructor .get (new TypeToken <LinkedHashMap <Integer , Integer >>() {}).construct ();
192
188
assertThat (actual ).isInstanceOf (LinkedHashMap .class );
193
189
}
194
190
You can’t perform that action at this time.
0 commit comments