com.consol.citrus.validation.matcher.ValidationMatcherConfig Java Examples

The following examples show how to use com.consol.citrus.validation.matcher.ValidationMatcherConfig. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Verify.java    From dew with Apache License 2.0 6 votes vote down vote up
/**
 * Verify resource descriptors.
 *
 * @param message      the message
 * @param expectedText the expected text
 * @param actualText   the actual text
 * @throws IOException    the io exception
 * @throws ParseException the parse exception
 */
default void verifyResourceDescriptors(String message, String expectedText, String actualText) throws IOException, ParseException {
    JsonTextMessageValidator validator = new JsonTextMessageValidator();
    validator.setStrict(false);

    TestContext context = new TestContext();
    context.getValidationMatcherRegistry()
            .getValidationMatcherLibraries()
            .add(new ValidationMatcherConfig().getValidationMatcherLibrary());

    validator.validateJson(message,
            (JSONObject) new JSONParser(JSONParser.DEFAULT_PERMISSIVE_MODE).parse(toJson(actualText)),
            (JSONObject) new JSONParser(JSONParser.DEFAULT_PERMISSIVE_MODE).parse(toJson(expectedText)),
            new JsonMessageValidationContext(),
            context,
            JsonPath.parse(actualText));
}
 
Example #2
Source File: Verify.java    From jkube with Eclipse Public License 2.0 5 votes vote down vote up
public static TestContext createTestContext() {
    TestContext context = new TestContext();
    context.getValidationMatcherRegistry()
           .getValidationMatcherLibraries()
           .add(new ValidationMatcherConfig().getValidationMatcherLibrary());
    return context;
}
 
Example #3
Source File: Verify.java    From jkube with Eclipse Public License 2.0 5 votes vote down vote up
public static TestContext createTestContext() {
    TestContext context = new TestContext();
    context.getValidationMatcherRegistry()
           .getValidationMatcherLibraries()
           .add(new ValidationMatcherConfig().getValidationMatcherLibrary());
    return context;
}
 
Example #4
Source File: SpringJavaConfigServiceTest.java    From citrus-admin with Apache License 2.0 5 votes vote down vote up
@Test
public void testValidationMatcherLibraryConfig() throws Exception {
    ValidationMatcherLibraryModel model = springJavaConfigService.getBeanDefinition(ValidationMatcherLibraryConfig.class, project, "myMatcherLibrary", ValidationMatcherLibraryModel.class);
    Assert.assertNotNull(model);
    Assert.assertEquals(model.getId(), "myMatcherLibrary");
    Assert.assertEquals(model.getPrefix(), "my:");
    Assert.assertEquals(model.getMatchers().size(), 1L);
    Assert.assertEquals(model.getMatchers().get(0).getName(), "foo");
    Assert.assertEquals(model.getMatchers().get(0).getClazz(), StartsWithValidationMatcher.class.getName());

    List<ValidationMatcherLibraryModel> list = springJavaConfigService.getBeanDefinitions(ValidationMatcherConfig.class, project, ValidationMatcherLibraryModel.class);
    Assert.assertEquals(list.size(), 1L);
}