Project { public void addNodes(Node... nodes) { Collections.addAll(this.nodes, nodes); } Project();  Project(List<Node> nodes); @XmlElement(name = "node") List<Node> getNodes(); void setNodes(List<Node> nodes); void addNodes(Node... nodes); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }
@Test public void testSimpleProject() throws Exception { Project project = new Project(); Node node = new Node("db-1", "db-1.example.com", "psql"); node.setTags(new String[]{"a", "b"}); node.setAttributes(ImmutableMap.of("key1", "val1", "key2", "val2")); project.addNodes(node); project.addNodes(new Node("web-1", "web-1.example.com", "django")); String actual = asXml(project); assertXMLEqual(actual, readResource("fixtures/project.xml"), actual); }