/**
   * Uses Nested Search Criteria for inheritance as association in search Verifies that the result
   * set is empty
   *
   * @throws ApplicationException
   */
  public void testZeroAssociationNestedSearch() throws ApplicationException {
    PrivateTeacher searchObject = new PrivateTeacher();
    searchObject.setName("Non-existent name");
    Collection results =
        getApplicationService()
            .search(
                "gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.PrivateTeacher", searchObject);

    assertNotNull(results);
    assertEquals(0, results.size());
  }
  /**
   * 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());
  }
  /**
   * Uses Nested Search Criteria for 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 testEntireObjectNestedSearch1() throws ApplicationException {
    PrivateTeacher searchObject = new PrivateTeacher();

    Collection results =
        getApplicationService()
            .search(
                "gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.PrivateTeacher", searchObject);

    assertNotNull(results);
    assertEquals(3, results.size());

    for (Iterator i = results.iterator(); i.hasNext(); ) {
      PrivateTeacher result = (PrivateTeacher) i.next();
      assertNotNull(result);
      assertNotNull(result.getId());
      assertNotNull(result.getName());
      assertNotNull(result.getYearsExperience());
    }
  }
  /**
   * Uses CQL Criteria for 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 testEntireObjectCQL1() throws ApplicationException {
    CQLQuery cqlQuery = new CQLQuery();
    CQLObject target = new CQLObject();

    target.setName("gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.PrivateTeacher");
    cqlQuery.setTarget(target);

    Collection results = getApplicationService().query(cqlQuery);

    assertNotNull(results);
    assertEquals(3, results.size());

    for (Iterator i = results.iterator(); i.hasNext(); ) {
      PrivateTeacher result = (PrivateTeacher) i.next();
      assertNotNull(result);
      assertNotNull(result.getId());
      assertNotNull(result.getName());
      assertNotNull(result.getYearsExperience());
    }
  }
  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 CQL 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 testAssociationCQL2() throws ApplicationException {
    CQLQuery cqlQuery = new CQLQuery();
    CQLObject target = new CQLObject();

    CQLAssociation association = new CQLAssociation();
    association.setName("gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.Teacher");
    association.setAttribute(new CQLAttribute("id", CQLPredicate.EQUAL_TO, "2"));

    target.setName("gov.nih.nci.cacoresdk.domain.inheritance.abstrakt.PrivateTeacher");
    target.setAssociation(association);
    cqlQuery.setTarget(target);

    Collection results = getApplicationService().query(cqlQuery);

    assertNotNull(results);
    assertEquals(1, results.size());

    PrivateTeacher result = (PrivateTeacher) results.iterator().next();
    assertNotNull(result);
    assertNotNull(result.getId());
    assertEquals(new Integer(2), result.getId());
  }