Skip to content

Commit 2c1e1c6

Browse files
committed
misc: Improve tree leaves test
1 parent 1ccfb2d commit 2c1e1c6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/test/java/software/coley/collections/TreeTest.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import java.util.List;
88
import java.util.Set;
99

10-
import static org.junit.jupiter.api.Assertions.assertEquals;
10+
import static org.junit.jupiter.api.Assertions.*;
1111

1212
/**
1313
* Tests for {@link Tree}
@@ -146,7 +146,11 @@ public void test_tree_gets_all_leaves() {
146146
tree.putTree("key4", "value4");
147147
tree.putTree("key5", "value5");
148148
// There are 6 leaves, as key1 has two children
149-
Set<Tree<String, String>> foo = tree.getAllLeaves();
150-
assertEquals(6, foo.size());
149+
Set<Tree<String, String>> leaves = tree.getAllLeaves();
150+
assertEquals(6, leaves.size());
151+
// Double check parent/child relation
152+
Tree<String, String> key1a = sub1.get("key1-a");
153+
assertSame(sub1, key1a.getParent());
154+
leaves.forEach(t -> assertNotNull(t.getParent()));
151155
}
152156
}

0 commit comments

Comments
 (0)