Skip to content

Commit

Permalink
Adding a shouldCreatePersonAndPatient test
Browse files Browse the repository at this point in the history
  • Loading branch information
dkayiwa committed Nov 14, 2016
1 parent cc4e47e commit 842ae76
Showing 1 changed file with 16 additions and 0 deletions.
Expand Up @@ -99,6 +99,22 @@ public void shouldCreateAPatient() throws Exception {
assertEquals(originalCount + 1, service.getAllPatients().size());
}

@Test
public void shouldCreatePersonAndPatient() throws Exception {
long originalCount = service.getAllPatients().size();
String json = "{ \"identifiers\": [{ \"identifier\":\"abc123ez\", "
+ "\"identifierType\":\"2f470aa8-1d73-43b7-81b5-01f0c0dfa53c\", "
+ "\"location\":\"9356400c-a5a2-4532-8f2b-2361b3446eb8\", " + "\"preferred\": true }], " + "\"person\": { "
+ "\"gender\": \"M\", " + "\"age\": 47, " + "\"birthdate\": \"1970-01-01T00:00:00.000+0100\", "
+ "\"birthdateEstimated\": false, " + "\"dead\": false, " + "\"deathDate\": null, "
+ "\"causeOfDeath\": null, " + "\"names\": [{\"givenName\": \"Thomas\", \"familyName\": \"Smith\"}] " + "}}";

SimpleObject newPatient = deserialize(handle(newPostRequest(getURI(), json)));

assertNotNull(PropertyUtils.getProperty(newPatient, "uuid"));
assertEquals(originalCount + 1, service.getAllPatients().size());
}

@Test
public void shouldVoidAPatient() throws Exception {
Patient patient = service.getPatientByUuid(getUuid());
Expand Down

0 comments on commit 842ae76

Please sign in to comment.