@Test
public void testSerializeResources_HeaderInfo() throws Exception {

  Result result = new ResultImpl(true);
  result.setResultStatus(new ResultStatus(ResultStatus.STATUS.OK));
  TreeNode<Resource> tree = result.getResultTree();
  tree.setName("items");
  tree.setProperty("isCollection", "true");
  tree.setProperty(CsvSerializer.PROPERTY_COLUMN_MAP, new TreeMap<String, String>() {{
    put("propertyD", "Property D");
    put("propertyC", "Property C");
    put("propertyB", "Property B");
    put("propertyA", "Property A");
  }});
  List<Map<String, Object>> data = new ArrayList<Map<String, Object>>() {
    {
      add(new HashMap<String, Object>() {
        {
          put("propertyD", "value1a");
          put("propertyC", "value2a");
          put("propertyB", "value3a");
          put("propertyA", "value4a");
        }
      });
      add(new HashMap<String, Object>() {
        {
          put("propertyD", "value1'b");
          put("propertyC", "value2'b");
          put("propertyB", "value3'b");
          put("propertyA", "value4'b");
        }
      });
      add(new HashMap<String, Object>() {
        {
          put("propertyD", "value1,c");
          put("propertyC", "value2,c");
          put("propertyB", "value3,c");
          put("propertyA", "value4,c");
        }
      });
    }
  };
  addChildResource(tree, "resource", 0, data.get(0));
  addChildResource(tree, "resource", 1, data.get(1));
  addChildResource(tree, "resource", 2, data.get(2));
  replayAll();
  //execute test
  Object o = new CsvSerializer().serialize(result).toString().replace("\r", "");
  verifyAll();
  String expected = "Property A,Property B,Property C,Property D\n" +
      "value4a,value3a,value2a,value1a\n" +
      "value4'b,value3'b,value2'b,value1'b\n" +
      "\"value4,c\",\"value3,c\",\"value2,c\",\"value1,c\"\n";
  assertEquals(expected, o);
}