@Test
public void getSubstitutableTemplateMap() {

    List<TNodeTemplate> templates = Arrays.asList(
        new TNodeTemplate.Builder("id0", stranger).build(),
        new TNodeTemplate.Builder("id1", parent).build(),
        new TNodeTemplate.Builder("id2", grandFather).build(),
        new TNodeTemplate.Builder("id3", aunt).build()
    );
    Map<TNodeTemplate, List<Subtypes<TNodeType>>> substitutableTemplates = SubstitutionUtils.collectSubstitutableTemplates(templates, nodeTypes);
    assertEquals(2, substitutableTemplates.size());
    assertTrue(substitutableTemplates.entrySet()
        .removeIf(entry -> grandFather.equals(entry.getKey().getTypeAsQName()))
    );
    assertTrue(substitutableTemplates.entrySet()
        .removeIf(entry -> parent.equals(entry.getKey().getType()))
    );
}