@Test
public void addChild() {

  List<String> segments = Arrays.asList("one", "two", "three");
  PathNode newChild = myParent.addChild(segments, 0, '/');
  List<PathNode> children = new ArrayList<>(myParent.getChildren());
  assertThat(children).hasSize(1);
  PathNode child = children.get(0);
  assertSame(child, newChild);
  assertEquals("one", child.getPathSegment());
  assertEquals("one", child.getPath());
  assertSame(myParent, child.getParent());
  children = new ArrayList<>(child.getChildren());
  assertThat(children).hasSize(1);
  child = children.get(0);
  assertEquals("two", child.getPathSegment());
  assertEquals("one/two", child.getPath());
  children = new ArrayList<>(child.getChildren());
  assertThat(children).hasSize(1);
  child = children.get(0);
  assertEquals("three", child.getPathSegment());
  assertEquals("one/two/three", child.getPath());
}