public void testCustomNilAndTypeKeysFormat() {
EOEditingContext editingContext = ERXEC.newEditingContext(_osc);
editingContext.lock();
try {
ERXRestFormat format = new ERXRestFormat("json", new ERXXmlRestParser(), new ERXXmlRestWriter(), new ERXRestFormatDelegate("id", "CUSTOM_TYPE", "CUSTOM_NIL", true, true, true, true, true));
Person p = Person.createPerson(editingContext, "Mike");
String output = format.toString(p, ERXKeyFilter.filterWithAttributes(), new ERXRestContext(editingContext));
assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<person CUSTOM_TYPE=\"person\">\n" + " <age CUSTOM_NIL=\"true\"/>\n" + " <name>Mike</name>\n" + " <salary CUSTOM_NIL=\"true\"/>\n" + "</person>\n", output);
Person parsedPerson = (Person) format.parse(output).createObjectWithFilter(null, ERXKeyFilter.filterWithAttributes(), new ERXRestContext(editingContext));
assertNotNull(parsedPerson);
assertEquals("Mike", parsedPerson.name());
assertNull(parsedPerson.age());
assertNull(parsedPerson.salary());
}