FolderNode extends AbstractNode { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } if (!super.equals(obj)) { return false; } final FolderNode other = (FolderNode) obj; return Objects.equals(this.path, other.path); } FolderNode(final String id, final String parentId, final String name, final File folder);  FolderNode(final String id, final String parentId, final String name); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }
@Test public void testEquals() throws Exception { FolderNode node1 = buildFolderNode(); FolderNode node2 = buildFolderNode(); assertEquals(node1, node1); assertEquals(node1, node2); assertNotEquals(node1, null); assertNotEquals(node1, "node1"); }