@Test
public void retrieveTypeHierarchy2() {

    Optional<List<Subtypes<TNodeType>>> tNodeTypeSubtypes = SubstitutionUtils.collectTypeHierarchy(nodeTypes, parent);
    assertTrue(tNodeTypeSubtypes.isPresent());
    List<Subtypes<TNodeType>> subtypes = tNodeTypeSubtypes.get();
    assertEquals(1, subtypes.size());
    Subtypes<TNodeType> firstChild = subtypes.get(0);
    assertEquals(CHILD, firstChild.getElement().getName());
    assertEquals(1, firstChild.getChildren().size());
    Subtypes<TNodeType> childOfFirstChild = firstChild.getChildren().get(0);
    assertEquals(GRANDCHILD, childOfFirstChild.getElement().getName());
    assertNull(childOfFirstChild.getChildren());
}