ConfigurationNode { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final ConfigurationNode other = (ConfigurationNode) obj; return Objects.equals(this.id, other.id) && Objects.equals(this.label, other.label) && Objects.equals(this.path, other.path); } ConfigurationNode(final String id, final String label, final String path); String getId(); String getLabel(); void setLabel(final String label); String getPath(); void setPath(final String path); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testEquals() throws Exception { ConfigurationNode node1 = new ConfigurationNode("id", "label", "path"); ConfigurationNode node2 = new ConfigurationNode("id", "label", "path"); ConfigurationNode node3 = new ConfigurationNode("id3", "label", "path"); ConfigurationNode node4 = new ConfigurationNode("id", "label4", "path"); ConfigurationNode node5 = new ConfigurationNode("id", "label", "path4"); assertEquals(node1, node1); assertEquals(node1, node2); assertNotEquals(node1, null); assertNotEquals(node1, "node1"); assertNotEquals(node1, node3); assertNotEquals(node1, node4); assertNotEquals(node1, node5); }