/** @see Encounter#removeObs(Obs) */ @Test @Verifies( value = "should not throw error when removing null obs from empty set", method = "removeObs(Obs)") public void removeObs_shouldNotThrowErrorWhenRemovingNullObsFromEmptySet() throws Exception { Encounter encounterWithoutObsSet = new Encounter(); encounterWithoutObsSet.removeObs(null); }
/** @see Encounter#removeObs(Obs) */ @Test @Verifies( value = "should not throw error when removing null obs from non empty set", method = "removeObs(Obs)") public void removeObs_shouldNotThrowErrorWhenRemovingNullObsFromNonEmptySet() throws Exception { Encounter encounterWithObsSet = new Encounter(); Set<Obs> obsSet = new HashSet<Obs>(); obsSet.add(new Obs()); encounterWithObsSet.setObs(obsSet); // make sure the encounter got the obs Assert.assertEquals(1, encounterWithObsSet.getAllObs(true).size()); encounterWithObsSet.removeObs(null); }
/** @see Encounter#removeObs(Obs) */ @Test @Verifies(value = "should remove obs successfully", method = "removeObs(Obs)") public void removeObs_shouldRemoveObsSuccessfully() throws Exception { Obs obsToRemove = new Obs(); Set<Obs> obsSet = new HashSet<Obs>(); obsSet.add(obsToRemove); // add the set of obs to the encounter and make sure its there Encounter encounter = new Encounter(); encounter.setObs(obsSet); Assert.assertEquals(1, encounter.getAllObs(true).size()); Assert.assertTrue(encounter.getAllObs(true).contains(obsToRemove)); // remove the obs and make sure its gone from the encounter encounter.removeObs(obsToRemove); Assert.assertEquals(0, encounter.getAllObs(true).size()); }