コード例 #1
0
  /**
   * @verifies {@link CohortService#removePatientFromCohort(Cohort,Patient)} test = should save
   *     cohort after removing patient
   */
  @Test
  @Verifies(
      value = "should save cohort after removing patient",
      method = "removePatientFromCohort(Cohort,Patient)")
  public void removePatientFromCohort_shouldSaveCohortAfterRemovingPatient() throws Exception {
    executeDataSet(COHORT_XML);

    // make a patient, add it using the method
    Patient patientToAddThenRemove = new Patient(4);
    service.addPatientToCohort(service.getCohort(2), patientToAddThenRemove);
    assertTrue(service.getCohort(2).contains(patientToAddThenRemove));
    service.removePatientFromCohort(service.getCohort(2), patientToAddThenRemove);
    assertFalse(service.getCohort(2).contains(patientToAddThenRemove));
  }
コード例 #2
0
  /**
   * @verifies {@link CohortService#removePatientFromCohort(Cohort,Patient)} test = should not fail
   *     if cohort does not contain patient
   */
  @Test
  @Verifies(
      value = "should not fail if cohort doesn't contain patient",
      method = "removePatientFromCohort(Cohort,Patient)")
  public void removePatientFromCohort_shouldNotFailIfCohortDoesNotContainPatient()
      throws Exception {
    executeDataSet(COHORT_XML);

    // make a patient
    Patient patientToAddThenRemove = new Patient(4);
    // verify that the patient is not already in the Cohort
    assertFalse(service.getCohort(2).contains(patientToAddThenRemove));
    // try to remove it from the cohort without failing
    try {
      service.removePatientFromCohort(service.getCohort(2), patientToAddThenRemove);
    } catch (Exception e) {
      Assert.fail(
          "removePatientFromCohort(Cohort,Patient) should not fail if cohort doesn't contain patient");
    }
  }