Skip to content

Commit

Permalink
misc: Improve tree leaves test
Browse files Browse the repository at this point in the history
  • Loading branch information
Col-E committed Sep 14, 2024
1 parent 1ccfb2d commit 2c1e1c6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/test/java/software/coley/collections/TreeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.List;
import java.util.Set;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.*;

/**
* Tests for {@link Tree}
Expand Down Expand Up @@ -146,7 +146,11 @@ public void test_tree_gets_all_leaves() {
tree.putTree("key4", "value4");
tree.putTree("key5", "value5");
// There are 6 leaves, as key1 has two children
Set<Tree<String, String>> foo = tree.getAllLeaves();
assertEquals(6, foo.size());
Set<Tree<String, String>> leaves = tree.getAllLeaves();
assertEquals(6, leaves.size());
// Double check parent/child relation
Tree<String, String> key1a = sub1.get("key1-a");
assertSame(sub1, key1a.getParent());
leaves.forEach(t -> assertNotNull(t.getParent()));
}
}

0 comments on commit 2c1e1c6

Please sign in to comment.