// convert to xml
Node root = p.toXML();
// write to file
Resource location = ResourceUtils.asResource("XMLTest.Property.xml");
try (OutputStream out = location.getOutputStream()) {
XMLHelper.write(out, root);
}
try (InputStream in = location.getInputStream()) {
root = XMLHelper.read(in);
}
p.fromXML(root);
// some tests
Assert.assertTrue(p.size() == 4);
Assert.assertTrue("mercedes".equals(p.get("car")));
Assert.assertTrue("cat".equals(p.get("pet")));
Assert.assertTrue(p.getInt("age") == 21);
Assert.assertTrue(p.getBoolean("single") == true);
// TODO this fails, something is not closed correctly
// delete file again
Assert.assertTrue(location.delete());
}