diff --git a/src/test/java/net/kemitix/node/NodeItemTest.java b/src/test/java/net/kemitix/node/NodeItemTest.java index 2702ae0..653ada5 100644 --- a/src/test/java/net/kemitix/node/NodeItemTest.java +++ b/src/test/java/net/kemitix/node/NodeItemTest.java @@ -10,6 +10,7 @@ import org.junit.rules.ExpectedException; import java.util.Arrays; import java.util.Collections; import java.util.Optional; +import java.util.Set; import static org.assertj.core.api.Assertions.assertThat; @@ -84,6 +85,17 @@ public class NodeItemTest { .contains(parent); } + @Test + public void shouldAddAsChildWhenCreatedWithParent() { + //given + final Node root = Nodes.namedRoot("root data", "root name"); + //when + final Node child = Nodes.namedChild("child data", "child name", root); + //then + final Set> children = root.getChildren(); + assertThat(children).containsExactly(child); + } + /** * Test that setting the parent on a node where the proposed parent is a * child of the node throws an exception.