File tree 1 file changed +2
-6
lines changed
src/test/java/com/thealgorithms/datastructures/trees 1 file changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ void test1() {
22
22
Assertions .assertEquals (7 , t .find (7 ).data );
23
23
}
24
24
25
- // Test for removing data and checking the new root
26
25
@ Test
27
26
void test2 () {
28
27
BinaryTree t = new BinaryTree ();
@@ -37,11 +36,8 @@ void test2() {
37
36
t .remove (5 );
38
37
t .remove (7 );
39
38
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
- }
39
+ Assertions .assertNotNull (t .getRoot (), "Root should not be null after removals." );
40
+ Assertions .assertEquals (9 , t .getRoot ().data ); // Direct access after ensuring non-null
45
41
}
46
42
47
43
// Test for attempting to remove a nonexistent node
You can’t perform that action at this time.
0 commit comments