@Test
public void testParse() throws BodyParseException {

  RequestBodyParser parser = new JsonRequestBodyParser();
  RequestBody body = parser.parse(serviceJson).iterator().next();
  Set<NamedPropertySet> setProps = body.getNamedPropertySets();
  assertEquals(1, setProps.size());
  Map<String, Object> mapExpected = new HashMap<String, Object>();
  mapExpected.put(PropertyHelper.getPropertyId("Services", "service_name"), "HDFS");
  mapExpected.put(PropertyHelper.getPropertyId("Services", "display_name"), "HDFS");
  mapExpected.put(PropertyHelper.getPropertyId("ServiceInfo", "cluster_name"), "tbmetrictest");
  mapExpected.put(PropertyHelper.getPropertyId("Services", "description"), "Apache Hadoop Distributed File System");
  mapExpected.put(PropertyHelper.getPropertyId("ServiceInfo", "state"), "STARTED");
  mapExpected.put(PropertyHelper.getPropertyId("OuterCategory", "propName"), "100");
  mapExpected.put(PropertyHelper.getPropertyId("OuterCategory/nested1/nested2", "innerPropName"), "innerPropValue");
  mapExpected.put(PropertyHelper.getPropertyId(null, "topLevelProp"), "value");
  assertEquals(mapExpected, setProps.iterator().next().getProperties());
  //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(mapExpected, setProps2.iterator().next().getProperties());
}