@Test
public void testAddDefinitionsAsPatternMatchers() {

    DefinitionPatternMatcherFactory factory1 = createMock(DefinitionPatternMatcherFactory.class);
    DefinitionPatternMatcherFactory factory2 = createMock(DefinitionPatternMatcherFactory.class);
    DefinitionPatternMatcher matcher1 = createMock(DefinitionPatternMatcher.class);
    DefinitionPatternMatcher matcher2 = createMock(DefinitionPatternMatcher.class);
    Definition definition1 = new Definition("DF1:definition1", (Attribute) null, null);
    Definition definition2 = new Definition("DF2:definition2", (Attribute) null, null);
    Definition definition3 = new Definition("noLanguageHere", (Attribute) null, null);
    expect(factory1.createDefinitionPatternMatcher("definition1", definition1)).andReturn(matcher1);
    expect(factory2.createDefinitionPatternMatcher("definition2", definition2)).andReturn(matcher2);
    replay(factory1, factory2, matcher1, matcher2);
    PrefixedPatternDefinitionResolver<Integer> resolver = new PrefixedPatternDefinitionResolver<Integer>();
    resolver.registerDefinitionPatternMatcherFactory("DF1", factory1);
    resolver.registerDefinitionPatternMatcherFactory("DF2", factory2);
    List<DefinitionPatternMatcher> matchers = new ArrayList<DefinitionPatternMatcher>();
    Map<String, Definition> definitions = new LinkedHashMap<String, Definition>();
    definitions.put("DF1:definition1", definition1);
    definitions.put("DF2:definition2", definition2);
    definitions.put("noLanguageHere", definition3);
    resolver.addDefinitionsAsPatternMatchers(matchers, definitions);
    assertEquals(2, matchers.size());
    assertEquals(matcher1, matchers.get(0));
    assertEquals(matcher2, matchers.get(1));
    verify(factory1, factory2, matcher1, matcher2);
}