@Override public boolean isValid(final ValidationConstraintContext vcc, final Object value) { return validate(value, pattern); }
@Test void testSetPattern() { WildcardPathMatchConstraint wildcardPathMatchConstraint = new WildcardPathMatchConstraint(); String pattern = "foo"; wildcardPathMatchConstraint.setPattern(pattern); assertEquals(pattern, wildcardPathMatchConstraint.getPattern()); }
@Test void testConfigure() { WildcardPathMatchConstraint wildcardPathMatchConstraint = new WildcardPathMatchConstraint(); WildcardPathMatch annotation = mock(WildcardPathMatch.class); String pattern = "foo"; when(annotation.value()).thenReturn(pattern); wildcardPathMatchConstraint.configure(annotation); assertEquals(pattern, wildcardPathMatchConstraint.getPattern()); }
@Test void testConstructor1() { WildcardPathMatchConstraint wildcardPathMatchConstraint = new WildcardPathMatchConstraint(); assertNull(wildcardPathMatchConstraint.getPattern()); }
@Test void testIsValid() { assertTrue(new WildcardPathMatchConstraint("/dir/**").isValid(mockContext(), "/dir/abc")); assertFalse(new WildcardPathMatchConstraint("/dir/abz").isValid(mockContext(), "/dir/abc")); } }
@Test void testConstructor2() { WildcardPathMatchConstraint wildcardPathMatchConstraint = new WildcardPathMatchConstraint("foo"); assertEquals(wildcardPathMatchConstraint.getPattern(), "foo"); }
@Test void testValidate_WithValIsNull() { assertTrue(WildcardPathMatchConstraint.validate(null, "*")); }
public boolean isValid(ValidationConstraintContext vcc, Object value) { return validate(value, pattern); }