Search in sources :

Example 1 with MapUnmarshaller

use of com.amazonaws.transform.MapUnmarshaller in project aws-sdk-android by aws-amplify.

the class JsonUnmarshallerTest method testSimpleMap.

@Test
public void testSimpleMap() throws Exception {
    JsonUnmarshallerContext unmarshallerContext = setupUnmarshaller(SIMPLE_MAP);
    MapUnmarshaller<String> unmarshaller = new MapUnmarshaller<String>(SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance());
    Map<String, String> map = unmarshaller.unmarshall(unmarshallerContext);
    assertTrue(map.size() == 2);
    assertEquals("value1", map.get("key1"));
    assertEquals("value2", map.get("key2"));
}
Also used : MapUnmarshaller(com.amazonaws.transform.MapUnmarshaller) JsonUnmarshallerContext(com.amazonaws.transform.JsonUnmarshallerContext) Test(org.junit.Test)

Example 2 with MapUnmarshaller

use of com.amazonaws.transform.MapUnmarshaller in project aws-sdk-android by aws-amplify.

the class JsonUnmarshallerTest method testMapToList.

@Test
public void testMapToList() throws Exception {
    JsonUnmarshallerContext unmarshallerContext = setupUnmarshaller(MAP_TO_LIST);
    MapUnmarshaller<List<String>> unmarshaller = new MapUnmarshaller<List<String>>(new ListUnmarshaller<String>(SimpleTypeJsonUnmarshallers.StringJsonUnmarshaller.getInstance()));
    Map<String, List<String>> map = unmarshaller.unmarshall(unmarshallerContext);
    assertTrue(map.size() == 2);
    assertEquals(Arrays.asList(null, "value1"), map.get("key1"));
    assertEquals(Arrays.asList("value2"), map.get("key2"));
}
Also used : MapUnmarshaller(com.amazonaws.transform.MapUnmarshaller) List(java.util.List) JsonUnmarshallerContext(com.amazonaws.transform.JsonUnmarshallerContext) Test(org.junit.Test)

Aggregations

JsonUnmarshallerContext (com.amazonaws.transform.JsonUnmarshallerContext)2 MapUnmarshaller (com.amazonaws.transform.MapUnmarshaller)2 Test (org.junit.Test)2 List (java.util.List)1