Skip to content

Commit

Permalink
Adding previously removed test - TRUNK-4056
Browse files Browse the repository at this point in the history
  • Loading branch information
dkayiwa committed Nov 19, 2013
1 parent f870162 commit 484106b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Expand Up @@ -1529,8 +1529,11 @@ public void mergePatients(Patient preferred, List<Patient> notPreferred) throws
*/
public PatientIdentifier savePatientIdentifier(PatientIdentifier patientIdentifier) throws APIException {
//if the argument or the following required fields are not specified
PatientIdentifierType.LocationBehavior locationBehavior = patientIdentifier.getIdentifierType()
.getLocationBehavior();
PatientIdentifierType.LocationBehavior locationBehavior = null;
if (patientIdentifier != null) {
patientIdentifier.getIdentifierType().getLocationBehavior();
}

if (patientIdentifier == null
|| patientIdentifier.getPatient() == null
|| patientIdentifier.getIdentifierType() == null
Expand Down
9 changes: 9 additions & 0 deletions api/src/test/java/org/openmrs/api/PatientServiceTest.java
Expand Up @@ -3446,4 +3446,13 @@ public void getCountOfPatients_shouldReturnTheRightCountOfPatientsWithAMatchingI
Assert.assertEquals(1, patientService.getCountOfPatients(identifier).intValue());
}

/**
* @verifies {@link PatientService#savePatientIdentifier(PatientIdentifier)} test = should throw
* an APIException when a null argument is passed
*/
@Test(expected = APIException.class)
@Verifies(value = "should throw an APIException when a null argument is passed", method = "savePatientIdentifier(PatientIdentifier)")
public void savePatientIdentifier_shouldThrowAnAPIExceptionWhenANullArgumentIsPassed() throws Exception {
patientService.savePatientIdentifier(null);
}
}

0 comments on commit 484106b

Please sign in to comment.