@Test
public void testRunSync() throws Exception {

    GroupRequest groupRequest = new GroupRequest();
    groupRequest.setTable(TestUtils.TEST_TABLE_NAME);
    groupRequest.setNesting(Arrays.asList("os", "device", "version"));
    Map<String, Object> expectedResponse = new LinkedHashMap<String, Object>();
    final Map<String, Object> nexusResponse = new LinkedHashMap<String, Object>(){{ put("1", 2); put("2", 2); put("3", 1); }};
    final Map<String, Object> galaxyResponse = new LinkedHashMap<String, Object>(){{ put("2", 1); put("3", 1); }};
    expectedResponse.put("android", new LinkedHashMap<String, Object>() {{
        put("nexus", nexusResponse);
        put("galaxy", galaxyResponse);
    }});
    final Map<String, Object> nexusResponse2 = new LinkedHashMap<String, Object>(){{ put("2", 1);}};
    final Map<String, Object> iPadResponse = new LinkedHashMap<String, Object>(){{ put("2", 2); }};
    final Map<String, Object> iPhoneResponse = new LinkedHashMap<String, Object>(){{ put("1", 1); }};
    expectedResponse.put("ios", new LinkedHashMap<String, Object>() {{
        put("nexus", nexusResponse2);
        put("ipad", iPadResponse);
        put("iphone", iPhoneResponse);
    }});
    WebResource webResource = client().resource("/v1/analytics");
    GroupResponse response = webResource.type(MediaType.APPLICATION_JSON_TYPE).post(GroupResponse.class, groupRequest);
    assertEquals(expectedResponse, response.getResult());
}