From ab1759dc3c3129a8c553115dd398538933160ecf Mon Sep 17 00:00:00 2001 From: John Bogovic Date: Fri, 3 May 2024 16:10:53 -0400 Subject: [PATCH] test(N5TreeNode): adding child nodes --- .../saalfeldlab/n5/universe/N5TreeNodeTest.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/janelia/saalfeldlab/n5/universe/N5TreeNodeTest.java b/src/test/java/org/janelia/saalfeldlab/n5/universe/N5TreeNodeTest.java index 38738db..a2309f1 100644 --- a/src/test/java/org/janelia/saalfeldlab/n5/universe/N5TreeNodeTest.java +++ b/src/test/java/org/janelia/saalfeldlab/n5/universe/N5TreeNodeTest.java @@ -11,8 +11,8 @@ public class N5TreeNodeTest { @Test - public void testStructureEquals() - { + public void testStructureEquals() { + N5TreeNode empty = new N5TreeNode(""); N5TreeNode a = new N5TreeNode("a"); @@ -49,8 +49,8 @@ public void testStructureEquals() } @Test - public void testAddingChildren() - { + public void testAddingChildren() { + final N5TreeNode control = new N5TreeNode(""); final N5TreeNode a = new N5TreeNode("a"); final N5TreeNode b = new N5TreeNode("a/b"); @@ -75,7 +75,11 @@ public void testAddingChildren() control.add(ant); ant.add(bat); - root.addPath("ant/bat"); + N5TreeNode ab = root.addPath("ant/bat"); + assertEquals("ant/bat", ab.getPath()); + assertEquals(0, ab.getDescendants(x -> { return x != ab; }).count()); + + assertTrue( root.getDescendant("ant/bat").isPresent() ); // make sure the tree has expected structure assertTrue( root.structureEquals(control));