use of org.apache.cayenne.testdo.relationships.MeaningfulFK in project cayenne by apache.
the class MeaningfulFKIT method testValidateForSave1.
@Test
public void testValidateForSave1() throws Exception {
MeaningfulFK testObject = context.newObject(MeaningfulFK.class);
ValidationResult validation = new ValidationResult();
testObject.validateForSave(validation);
assertTrue("Must fail validation due to missing required relationship", validation.hasFailures());
assertEquals("Must fail validation due to missing required relationship", 1, validation.getFailures().size());
}
use of org.apache.cayenne.testdo.relationships.MeaningfulFK in project cayenne by apache.
the class MeaningfulFKIT method testValidateForSave2.
@Test
public void testValidateForSave2() throws Exception {
MeaningfulFK testObject = context.newObject(MeaningfulFK.class);
RelationshipHelper related = testObject.getObjectContext().newObject(RelationshipHelper.class);
testObject.setToRelationshipHelper(related);
ValidationResult validation = new ValidationResult();
testObject.validateForSave(validation);
assertFalse(validation.hasFailures());
}
Aggregations