Skip to content

Commit f2fef25

Browse files
committed
Fix issue Infer build
1 parent 9654d1a commit f2fef25

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.thealgorithms.datastructures.trees;
22

33
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import static org.junit.jupiter.api.Assertions.fail;
45

56
import org.junit.jupiter.api.Test;
67

@@ -35,7 +36,12 @@ void test2() {
3536
t.remove(5);
3637
t.remove(7);
3738

38-
assertEquals(t.getRoot().data, 9);
39+
// Checks whether the root is null before accessing date
40+
if (t.getRoot() != null) {
41+
assertEquals(t.getRoot().data, 9);
42+
} else {
43+
fail("The root node is null after removal.");
44+
}
3945
}
4046

4147
// checks that removing an unexistend node returns false

0 commit comments

Comments
 (0)