@Test
public void testSerializeResourcesAsArray() throws Exception {

  UriInfo uriInfo = createMock(UriInfo.class);
  Resource resource = createMock(Resource.class);
  //Resource resource2 = createMock(Resource.class);
  Result result = new ResultImpl(true);
  result.setResultStatus(new ResultStatus(ResultStatus.STATUS.OK));
  TreeNode<Resource> tree = result.getResultTree();
  //tree.setName("items");
  TreeNode<Resource> child = tree.addChild(resource, "resource1");
  child.setProperty("href", "this is an href");
  tree.addChild(resource, "resource2");
  //child.addChild(resource2, "sub-resource");
  // resource properties
  Map<String, Object> mapRootProps = new LinkedHashMap<String, Object>();
  mapRootProps.put("prop2", "value2");
  mapRootProps.put("prop1", "value1");
  Map<String, Object> mapCategoryProps = new LinkedHashMap<String, Object>();
  mapCategoryProps.put("catProp1", "catValue1");
  mapCategoryProps.put("catProp2", "catValue2");
  Map<String, Map<String, Object>> propertyMap = new LinkedHashMap<String, Map<String, Object>>();
  propertyMap.put(null, mapRootProps);
  propertyMap.put("category", mapCategoryProps);
  //expectations
  expect(resource.getPropertiesMap()).andReturn(propertyMap).anyTimes();
  expect(resource.getType()).andReturn(Resource.Type.Cluster).anyTimes();
  replay(uriInfo, resource/*, resource2*/);
  //execute test
  Object o = new JsonSerializer().serialize(result).toString().replace("\r", "");
  String expected = "[\n" +
  "  {\n" +
  "    \"href\" : \"this is an href\",\n" +
  "    \"prop2\" : \"value2\",\n" +
  "    \"prop1\" : \"value1\",\n" +
  "    \"category\" : {\n" +
  "      \"catProp1\" : \"catValue1\",\n" +
  "      \"catProp2\" : \"catValue2\"\n" +
  "    }\n" +
  "  },\n" +
  "  {\n" +
  "    \"prop2\" : \"value2\",\n" +
  "    \"prop1\" : \"value1\",\n" +
  "    \"category\" : {\n" +
  "      \"catProp1\" : \"catValue1\",\n" +
  "      \"catProp2\" : \"catValue2\"\n" +
  "    }\n" +
  "  }\n" +
  "]";
  assertEquals(expected, o);
  verify(uriInfo, resource/*, resource2*/);
}