diff --git a/src/main/java/de/joethei/hs/java2/vorlesungen/binaryTree/Tree.java b/src/main/java/de/joethei/hs/java2/vorlesungen/binaryTree/Tree.java index 380691b..95d6b6d 100644 --- a/src/main/java/de/joethei/hs/java2/vorlesungen/binaryTree/Tree.java +++ b/src/main/java/de/joethei/hs/java2/vorlesungen/binaryTree/Tree.java @@ -11,4 +11,10 @@ public class Tree { public Node getRoot() { return root; } + + @Override + public boolean equals(Object obj) { + if(obj instanceof Tree) return root.equals(obj); + return false; + } } \ No newline at end of file diff --git a/src/test/java/de/joethei/hs/java2/tests/VorlesungsTest.java b/src/test/java/de/joethei/hs/java2/tests/VorlesungsTest.java index 198b7be..3cf05d8 100644 --- a/src/test/java/de/joethei/hs/java2/tests/VorlesungsTest.java +++ b/src/test/java/de/joethei/hs/java2/tests/VorlesungsTest.java @@ -28,5 +28,6 @@ public class VorlesungsTest { assertEquals(Integer.valueOf(45), tree.getRoot().getValue()); assertEquals(Integer.valueOf(14), tree.getRoot().getLeft().getValue()); assertEquals(Integer.valueOf(16), tree.getRoot().getRight().getValue()); + assertEquals(new Node(13, new Node<>(14), new Node<>(16)), new Node(13, new Node<>(14), new Node<>(16))); } } \ No newline at end of file