@Test
public void testParse_QueryPost() throws BodyParseException {

  RequestBodyParser parser = new JsonRequestBodyParser();
  RequestBody body = parser.parse(queryPostJson).iterator().next();
  Set<NamedPropertySet> setProperties = body.getNamedPropertySets();
  assertEquals(1, setProperties.size());
  boolean contains1 = false;
  boolean contains2 = false;
  boolean contains3 = false;
  for (NamedPropertySet ps : setProperties) {
    Map<String, Object> mapProps = ps.getProperties();
    assertEquals(1, mapProps.size());
    Set<Map<String, Object>> set = (Set<Map<String, Object>>) mapProps.get("services");
    for (Map<String, Object> map : set) {
      String serviceName = (String) map.get("ServiceInfo/service_name");
      if (serviceName.equals("unitTestService1")) {
        assertEquals(1, map.size());
        contains1 = true;
      } else if (serviceName.equals("unitTestService2")) {
        assertEquals("prop1Value", map.get("ServiceInfo/property1"));
        assertEquals(2, map.size());
        contains2 = true;
      } else if (serviceName.equals("unitTestService3")) {
        assertEquals("prop2Value", map.get("ServiceInfo/Category/property2"));
        assertEquals(2, map.size());
        contains3 = true;
      } else {
        fail("Unexpected service name");
      }
    }
  }
  assertTrue(contains1);
  assertTrue(contains2);
  assertTrue(contains3);
  //assert body is correct by checking that properties match
  String b = body.getBody();
  body = parser.parse(b).iterator().next();
  Set<NamedPropertySet> setProps2 = body.getNamedPropertySets();
  assertEquals(1, setProps2.size());
  assertEquals(setProperties, setProps2);
  assertEquals("java.util.LinkedHashSet",
          body.getNamedPropertySets().iterator().next().getProperties().get("services").getClass().getName());
}