@Test public void testAttributeValidationForEmptyBean() { myBeanPm.setPmBean(new MyBean(null, null, null)); Assert.assertEquals( "The @Size.max constraint is read from the bean restriction.", 4, myBeanPm.s.getMaxLen()); PmValidationApi.validate(myBeanPm); assertTrue(myBeanPm.s.isPmValid()); assertFalse(myBeanPm.i.isPmValid()); assertFalse(myBeanPm.j.isPmValid()); }
@Test public void testValidationOfBeanTriggeredByPmBean() { myBeanPm.setPmBean(new MyBean("hi", 2, 1)); assertFalse(PmValidationApi.validate(myBeanPm)); }