@Test
public void readSimpleMap() throws Exception {

    JSONObject mockJsonObject = mock(JSONObject.class);
    List<String> keys = Arrays.asList("result");
    when(mockJsonObject.keys()).thenReturn(keys.iterator());
    when(mockJsonObject.get("result")).thenReturn("dummyResult");
    JSONTokener mockJsonTokener = mock(JSONTokener.class);
    when(mockJsonTokener.nextValue()).thenReturn(mockJsonObject);
    when(mockJsonObjectManager.newTokener(anyString())).thenReturn(mockJsonTokener);
    // This string doesn't matter, but it's what we mimic with the mocks.
    String mapResponse = "{\"result\": \"dummyResult\"}";
    StringReader reader = new StringReader(mapResponse);
    Map<String, Object> map = handler.readJson(reader);
    assertNotNull(map);
    assertEquals(1, map.size());
    assertTrue(map.containsKey("result"));
    assertEquals("dummyResult", map.get("result"));
}