public void testGetAssociation() throws ApplicationException { PrivateTeacher searchObject = new PrivateTeacher(); searchObject.setId(new Integer(1)); Collection results = getApplicationService() .search( "gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.PrivateTeacher", searchObject); assertNotNull(results); assertEquals(1, results.size()); Pupil pupil; for (Iterator i = results.iterator(); i.hasNext(); ) { PrivateTeacher result = (PrivateTeacher) i.next(); assertNotNull(result); assertNotNull(result.getId()); assertNotNull(result.getYearsExperience()); for (Iterator j = result.getPupilCollection().iterator(); j.hasNext(); ) { pupil = (Pupil) j.next(); assertNotNull(pupil); assertNotNull(pupil.getId()); assertNotNull(pupil.getName()); } } }
/** * Uses Nested Search Criteria for inheritance as association in search Verifies that the results * are returned Verifies size of the result set Verifies that none of the attribute is null * * @throws ApplicationException */ public void testAssociationNestedSearch2() throws ApplicationException { PrivateTeacher searchObject = new PrivateTeacher(); searchObject.setId(new Integer(1)); Collection results = getApplicationService() .search("gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.Teacher", searchObject); assertNotNull(results); assertEquals(1, results.size()); Teacher result = (Teacher) results.iterator().next(); assertNotNull(result); assertNotNull(result.getId()); assertEquals(new Integer(1), result.getId()); }