@Test
public void test1() throws Exception {
// test read
String input = loadStreamToString(getClass().getResourceAsStream("propfind1.xml"));
Propfind propfind = read(input);
Prop prop = propfind.getProp();
Assert.assertEquals(PROPERTIES.length, prop.getAny().size());
for (QName qname : PROPERTIES) {
Element element = prop.getAnyByName(qname);
Assert.assertNotNull(element);
Assert.assertEquals(qname.getNamespaceURI(), element.getNamespaceURI());
Assert.assertEquals(qname.getLocalPart(), element.getLocalName());
}
Assert.assertFalse(propfind.isAllprop());
Assert.assertFalse(propfind.isPropname());
// test write
Diff diff = new Diff(input, write(propfind));
Assert.assertTrue(diff.toString(), diff.similar());
// test runtime creation
propfind = new Propfind();
prop = new Prop();
propfind.setProp(prop);
prop.setProperty(PROPERTIES[0]);
prop.setProperty(PROPERTIES[1]);
prop.setProperty(PROPERTIES[2]);
prop.setProperty(PROPERTIES[3]);
diff = new Diff(input, write(propfind));