We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3e2564a commit 781ec96Copy full SHA for 781ec96
src/test/java/com/thealgorithms/datastructures/trees/BinaryTreeTest.java
@@ -37,8 +37,11 @@ void test2() {
37
t.remove(5);
38
t.remove(7);
39
40
- Assertions.assertNotNull(t.getRoot(), "Root should not be null after removals.");
41
- Assertions.assertEquals(9, t.getRoot().data); // Direct access after ensuring non-null
+ BinaryTree.Node root = t.getRoot();
+ Assertions.assertNotNull(root, "Root should not be null after removals.");
42
+ if (root != null) { // Additional null check for tool satisfaction
43
+ Assertions.assertEquals(9, root.data);
44
+ }
45
}
46
47
// Test for attempting to remove a nonexistent node
0 commit comments