NodeItemTest: check that child is added to parent
This commit is contained in:
parent
77a7946e9c
commit
d73a46b905
1 changed files with 12 additions and 0 deletions
|
@ -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<String> root = Nodes.namedRoot("root data", "root name");
|
||||
//when
|
||||
final Node<String> child = Nodes.namedChild("child data", "child name", root);
|
||||
//then
|
||||
final Set<Node<String>> 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.
|
||||
|
|
Loading…
Reference in a new issue