use of org.jowidgets.cap.ui.impl.beans.IPerson in project jo-client-platform by jo-source.
the class BeanProxyImplTest method testValidateInvalidPersonAfterValidatorsAdded.
@Test
public void testValidateInvalidPersonAfterValidatorsAdded() {
final IBeanProxy<IPerson> invalidPersonProxy = createPersonProxy(invalidPersonDto);
IValidationResult validationResult = invalidPersonProxy.validate();
Assert.assertTrue(validationResult.isOk());
// after adding validators, bean must have validation error
invalidPersonProxy.addBeanPropertyValidators(personValidators);
validationResult = invalidPersonProxy.validate();
Assert.assertFalse(validationResult.isValid());
final IValidationMessage worstFirst = validationResult.getWorstFirst();
Assert.assertEquals(personAttributes.getAttribute(IPerson.NAME_PROPERTY).getCurrentLabel(), worstFirst.getContext());
Assert.assertEquals(MessageType.ERROR, worstFirst.getType());
}
use of org.jowidgets.cap.ui.impl.beans.IPerson in project jo-client-platform by jo-source.
the class BeanProxyImplTest method testValidBeanProxyCreation.
@Test
public void testValidBeanProxyCreation() {
final IBeanProxy<IPerson> personProxy = createPersonProxy(personDto, personValidators);
final IPerson person = personProxy.getBean();
Assert.assertEquals(PERSON_NAME, person.getName());
Assert.assertEquals(PERSON_LAST_NAME, person.getLastname());
Assert.assertEquals(PERSON_GENDER, person.getGender());
Assert.assertFalse(personProxy.isModified(IPerson.NAME_PROPERTY));
Assert.assertFalse(personProxy.isModified(IPerson.LAST_NAME_PROPERTY));
Assert.assertFalse(personProxy.isModified(IPerson.GENDER_PROPERTY));
final IValidationResult validationResult = personProxy.validate();
Assert.assertTrue(validationResult.isOk());
}
Aggregations