Skip to content

Commit 213ec92

Browse files
resolved more spotbugs
1 parent f4169c4 commit 213ec92

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/test/java/com/thealgorithms/datastructures/trees/BinaryTreeTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,11 @@ void test2() {
3737
t.remove(5);
3838
t.remove(7);
3939

40-
Assertions.assertNotNull(t.getRoot(), "Root should not be null after removals.");
41-
Assertions.assertEquals(9, t.getRoot().data);
40+
BinaryTree.Node newRoot = t.getRoot();
41+
Assertions.assertNotNull(newRoot, "Root should not be null after removals.");
42+
if (newRoot != null) { // Add null check
43+
Assertions.assertEquals(9, newRoot.data);
44+
}
4245
}
4346

4447
// Test for attempting to remove a nonexistent node

0 commit comments

Comments
 (0)