beanDefinitionContext = createApplicationContext("context");
Map<String, ValidationMatcherLibrary> matcherLibraries = beanDefinitionContext.getBeansOfType(ValidationMatcherLibrary.class);
Assert.assertEquals(matcherLibraries.size(), 2L);
ValidationMatcherLibrary matcherLibraryBean = matcherLibraries.get("matcherLib");
Assert.assertEquals(matcherLibraryBean.getName(), "matcherLib");
Assert.assertEquals(matcherLibraryBean.getPrefix(), "foo");
Assert.assertEquals(matcherLibraryBean.getMembers().size(), 3L);
Assert.assertEquals(matcherLibraryBean.getMembers().get("start").getClass(), StartsWithValidationMatcher.class);
Assert.assertEquals(matcherLibraryBean.getMembers().get("end").getClass(), EndsWithValidationMatcher.class);
Assert.assertEquals(matcherLibraryBean.getMembers().get("custom").getClass(), CustomValidationMatcher.class);
matcherLibraryBean.getMembers().get("custom").validate("field", "Hello Citrus!", "Hello Citrus!", context);
matcherLibraryBean = matcherLibraries.get("matcherLib2");
Assert.assertEquals(matcherLibraryBean.getName(), "matcherLib2");
Assert.assertEquals(matcherLibraryBean.getPrefix(), "bar");
Assert.assertEquals(matcherLibraryBean.getMembers().size(), 2L);
Assert.assertEquals(matcherLibraryBean.getMembers().get("isNumber").getClass(), IsNumberValidationMatcher.class);
Assert.assertEquals(matcherLibraryBean.getMembers().get("custom").getClass(), CustomValidationMatcher.class);
matcherLibraryBean.getMembers().get("custom").validate("field", "Hello Citrus!", "Hello Citrus!", context);
}