unit tests for head operation

-reverting the removal of the unit test but with the correct status code
-added unit test for a valid patient
This commit is contained in:
Corina Dalaban 2018-08-08 12:10:10 +03:00 committed by James Agnew
parent 65a54bfe29
commit d46878be86
1 changed files with 22 additions and 0 deletions

View File

@ -55,6 +55,28 @@ public class BanUnsupprtedHttpMethodsInterceptorDstu3Test {
}
}
@Test
public void testHeadJsonWithInvalidPatient() throws Exception {
HttpHead httpGet = new HttpHead("http://localhost:" + ourPort + "/Patient/123");
HttpResponse status = ourClient.execute(httpGet);
assertEquals(null, status.getEntity());
ourLog.info(status.toString());
assertEquals(404, status.getStatusLine().getStatusCode());
assertThat(status.getFirstHeader("x-powered-by").getValue(), containsString("HAPI"));
}
@Test
public void testHeadJsonWithValidPatient() throws Exception {
HttpHead httpGet = new HttpHead("http://localhost:" + ourPort + "/Patient/1");
HttpResponse status = ourClient.execute(httpGet);
assertEquals(null, status.getEntity());
ourLog.info(status.toString());
assertEquals(200, status.getStatusLine().getStatusCode());
assertThat(status.getFirstHeader("x-powered-by").getValue(), containsString("HAPI"));
}
@Test
public void testHttpTrackNotEnabled() throws Exception {
HttpRequestBase req = new HttpRequestBase() {