@Test public void isValid() { ConfigItem configItem = mock(ConfigItem.class); Element dummy = mock(Element.class); when(configItem.getUnmatched()).thenReturn(Collections.singletonList(dummy)); assertThat(validator.isValid(configItem, cvc)).isTrue(); }
@Override public boolean isValid(ConfigItem configItem, ConstraintValidatorContext constraintValidatorContext) { Optional.ofNullable(configItem.getUnmatched()).ifPresent( list -> { list.forEach(e -> { if (Element.class.isAssignableFrom(e.getClass())) { Element element = Element.class.cast(e); LOGGER.warn("Ignoring unknown/unmatched json element: {}", element.getTagName()); } }); } ); return true; }
NoUnmatchedElementsValidator implements ConstraintValidator<NoUnmatchedElements, ConfigItem> { @Override public boolean isValid(ConfigItem configItem, ConstraintValidatorContext constraintValidatorContext) { Optional.ofNullable(configItem.getUnmatched()).ifPresent( list -> { list.forEach(e -> { if (Element.class.isAssignableFrom(e.getClass())) { Element element = Element.class.cast(e); LOGGER.warn("Ignoring unknown/unmatched json element: {}", element.getTagName()); } }); } ); return true; } }
NoUnmatchedElementsValidator implements ConstraintValidator<NoUnmatchedElements, ConfigItem> { @Override public boolean isValid(ConfigItem configItem, ConstraintValidatorContext constraintValidatorContext) { Optional.ofNullable(configItem.getUnmatched()).ifPresent( list -> { list.forEach(e -> { if (Element.class.isAssignableFrom(e.getClass())) { Element element = Element.class.cast(e); LOGGER.warn("Ignoring unknown/unmatched json element: {}", element.getTagName()); } }); } ); return true; }  }
NoUnmatchedElementsValidator implements ConstraintValidator<NoUnmatchedElements, ConfigItem> { @Override public boolean isValid(ConfigItem configItem, ConstraintValidatorContext constraintValidatorContext) { Optional.ofNullable(configItem.getUnmatched()).ifPresent( list -> { list.forEach(e -> { if (Element.class.isAssignableFrom(e.getClass())) { Element element = Element.class.cast(e); LOGGER.warn("Ignoring unknown/unmatched json element: {}", element.getTagName()); } }); } ); return true; }  @Override void initialize(NoUnmatchedElements config); @Override boolean isValid(ConfigItem configItem, ConstraintValidatorContext constraintValidatorContext); }
NoUnmatchedElementsValidator implements ConstraintValidator<NoUnmatchedElements, ConfigItem> { @Override public boolean isValid(ConfigItem configItem, ConstraintValidatorContext constraintValidatorContext) { Optional.ofNullable(configItem.getUnmatched()).ifPresent( list -> { list.forEach(e -> { if (Element.class.isAssignableFrom(e.getClass())) { Element element = Element.class.cast(e); LOGGER.warn("Ignoring unknown/unmatched json element: {}", element.getTagName()); } }); } ); return true; }  @Override void initialize(NoUnmatchedElements config); @Override boolean isValid(ConfigItem configItem, ConstraintValidatorContext constraintValidatorContext);  }