Updating Map tests.
This commit is contained in:
parent
bf4ab04413
commit
5af0b16641
@ -157,12 +157,7 @@ public class MapTest extends TestCase {
|
||||
@SuppressWarnings("unchecked")
|
||||
public void testParameterizedMapSubclassDeserialization() {
|
||||
Type type = new TypeToken<MyParameterizedMap<String, Integer>>() {}.getType();
|
||||
Gson gson = new GsonBuilder().registerTypeAdapter(type,
|
||||
new InstanceCreator<MyParameterizedMap>() {
|
||||
public MyParameterizedMap createInstance(Type type) {
|
||||
return new MyParameterizedMap();
|
||||
}
|
||||
}).create();
|
||||
Gson gson = new Gson();
|
||||
String json = "{\"a\":1,\"b\":2}";
|
||||
MyParameterizedMap<String, Integer> map = gson.fromJson(json, type);
|
||||
assertEquals(1, map.get("a").intValue());
|
||||
@ -191,7 +186,7 @@ public class MapTest extends TestCase {
|
||||
assertEquals("2", map.get("b"));
|
||||
}
|
||||
|
||||
public void disable_testMapSubclassDeserialization() {
|
||||
public void testMapSubclassDeserialization() {
|
||||
Gson gson = new GsonBuilder().registerTypeAdapter(MyMap.class, new InstanceCreator<MyMap>() {
|
||||
public MyMap createInstance(Type type) {
|
||||
return new MyMap();
|
||||
|
Loading…
Reference in New Issue
Block a user