@Test public void testThatIsNotValidIfMatchIsPartial() { StellaPatternValidator validator = new StellaPatternValidator(); validator.initialize( new Mirror().on(AnnotatedModel3.class).reflect().annotation(Pattern.class).atField("i")); Assert.assertEquals(false, validator.isValid("babac", context)); }
@Test public void testThatNullIsValid() { StellaPatternValidator validator = new StellaPatternValidator(); validator.initialize( new Mirror().on(AnnotatedModel3.class).reflect().annotation(Pattern.class).atField("i")); Assert.assertEquals(true, validator.isValid(null, context)); }
@Test public void testThatIsValidIfPatternMatchesWholeString() { StellaPatternValidator validator = new StellaPatternValidator(); validator.initialize( new Mirror().on(AnnotatedModel2.class).reflect().annotation(Pattern.class).atField("i")); Assert.assertEquals(true, validator.isValid("babac", context)); }