@Test
public void referenceToMissingTypeShouldFail() {

    ReferencedParser referencedParser = new ReferencedParser("missingParser");
    ParsingContextExecution contextExecution = new ParsingContextExecution();
    try {
        contextExecution.init();
        contextExecution.setRegistry(Maps.newHashMap());
        Node node = Mockito.mock(Node.class);
        Mockito.when(node.getStartMark()).thenReturn(new Mark("name", 0, 10, 10, "", 0));
        Mockito.when(node.getEndMark()).thenReturn(new Mark("name", 0, 10, 10, "", 0));
        referencedParser.parse(node, contextExecution);
        assertEquals(ParsingErrorLevel.ERROR, contextExecution.getParsingErrors().get(0).getErrorLevel());
        assertEquals(ErrorCode.ALIEN_MAPPING_ERROR, contextExecution.getParsingErrors().get(0).getErrorCode());
    } finally {
        ParsingContextExecution.destroy();
    }
}