Updating Map tests.

This commit is contained in:
Joel Leitch 2011-04-04 19:07:20 +00:00
parent bf4ab04413
commit 5af0b16641

View File

@ -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();