From 255131164ba6d29507f4fa4d1d077d463a141f2a Mon Sep 17 00:00:00 2001 From: James Agnew Date: Fri, 10 Jun 2016 18:56:41 -0500 Subject: [PATCH] Fix more unit tests for #378 --- .../AbstractJaxRsConformanceProviderDstu3Test.java | 4 ++-- .../fhir/jpa/provider/SystemProviderDstu2Test.java | 2 +- .../jpa/provider/dstu3/SystemProviderDstu3Test.java | 4 ++-- .../model/primitive/BaseDateTimeDtDstu2Test.java | 2 +- ...OperationServerWithSearchParamTypesDstu2Test.java | 6 +++--- .../server/ServerConformanceProviderDstu2Test.java | 2 +- .../ResponseHighlightingInterceptorTest.java | 2 +- ...OperationServerWithSearchParamTypesDstu3Test.java | 6 +++--- .../server/ServerConformanceProviderDstu3Test.java | 12 ++++-------- 9 files changed, 18 insertions(+), 22 deletions(-) diff --git a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu3Test.java b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu3Test.java index c12f12b0b4d..6fafc9d1be5 100644 --- a/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu3Test.java +++ b/hapi-fhir-jaxrsserver-base/src/test/java/ca/uhn/fhir/jaxrs/server/AbstractJaxRsConformanceProviderDstu3Test.java @@ -70,7 +70,7 @@ public class AbstractJaxRsConformanceProviderDstu3Test { Response response = createConformanceProvider(providers).conformance(); assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus()); assertTrue(response.getEntity().toString().contains("\"type\":\"Patient\"")); - assertTrue(response.getEntity().toString().contains("\"$someCustomOperation")); + assertTrue(response.getEntity().toString().contains("\"someCustomOperation")); System.out.println(response); System.out.println(response.getEntity()); } @@ -84,7 +84,7 @@ public class AbstractJaxRsConformanceProviderDstu3Test { assertEquals(Constants.STATUS_HTTP_200_OK, response.getStatus()); System.out.println(response.getEntity()); assertTrue(response.getEntity().toString().contains(" ")); - assertTrue(response.getEntity().toString().contains("\"$someCustomOperation")); + assertTrue(response.getEntity().toString().contains("\"someCustomOperation")); System.out.println(response.getEntity()); } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java index 0e75e422997..db9814cf222 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/SystemProviderDstu2Test.java @@ -141,7 +141,7 @@ public class SystemProviderDstu2Test extends BaseJpaDstu2Test { try { String response = IOUtils.toString(http.getEntity().getContent()); ourLog.info(response); - assertThat(response, not(containsString("_format"))); + assertThat(response, (containsString("_format=json"))); assertEquals(200, http.getStatusLine().getStatusCode()); } finally { http.close(); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SystemProviderDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SystemProviderDstu3Test.java index 130fb0597c4..6a98c8238d1 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SystemProviderDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/SystemProviderDstu3Test.java @@ -315,7 +315,7 @@ public class SystemProviderDstu3Test extends BaseJpaDstu3Test { try { String response = IOUtils.toString(http.getEntity().getContent()); ourLog.info(response); - assertThat(response, not(containsString("_format"))); + assertThat(response, containsString("_format=json")); assertEquals(200, http.getStatusLine().getStatusCode()); } finally { http.close(); @@ -454,7 +454,7 @@ public class SystemProviderDstu3Test extends BaseJpaDstu3Test { @Test public void testGetOperationDefinition() { OperationDefinition op = ourClient.read(OperationDefinition.class, "get-resource-counts"); - assertEquals("$get-resource-counts", op.getCode()); + assertEquals("get-resource-counts", op.getCode()); } @Test diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/primitive/BaseDateTimeDtDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/primitive/BaseDateTimeDtDstu2Test.java index 97ed09e287f..323b6554c3c 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/primitive/BaseDateTimeDtDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/model/primitive/BaseDateTimeDtDstu2Test.java @@ -163,7 +163,7 @@ public class BaseDateTimeDtDstu2Test { @Test public void testParseIgnoresLeadingAndTrailingSpace() { DateTimeDt dt = new DateTimeDt(" 2014-10-11T12:11:00Z "); - assertEquals("", myDateInstantZoneParser.format(dt.getValue())); + assertEquals("2014-10-11 10:11:00.000-0200", myDateInstantZoneParser.format(dt.getValue())); } @Test diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu2Test.java index fd6cb681cd0..7f5abcb51c4 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu2Test.java @@ -164,17 +164,17 @@ public class OperationServerWithSearchParamTypesDstu2Test { assertThat(conf, stringContainsInOrder( "", "", - "" + "" )); assertThat(conf, stringContainsInOrder( "", "", - "" + "" )); assertThat(conf, stringContainsInOrder( "", "", - "" + "" )); //@formatter:on diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerConformanceProviderDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerConformanceProviderDstu2Test.java index b90e169237f..621f604408b 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerConformanceProviderDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/ServerConformanceProviderDstu2Test.java @@ -136,7 +136,7 @@ public class ServerConformanceProviderDstu2Test { ourLog.info(conf); assertEquals(1, conformance.getRest().get(0).getOperation().size()); - assertEquals("$everything", conformance.getRest().get(0).getOperation().get(0).getName()); + assertEquals("everything", conformance.getRest().get(0).getOperation().get(0).getName()); assertEquals("OperationDefinition/everything", conformance.getRest().get(0).getOperation().get(0).getDefinition().getReference().getValue()); } diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/ResponseHighlightingInterceptorTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/ResponseHighlightingInterceptorTest.java index 79545676208..8d2f9a4c7d1 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/ResponseHighlightingInterceptorTest.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/interceptor/ResponseHighlightingInterceptorTest.java @@ -376,7 +376,7 @@ public class ResponseHighlightingInterceptorTest { ourLog.info(output); assertThat(output, containsString("Patient")); assertThat(output, not(stringContainsInOrder("", "
", "\n", "
"))); - assertThat(output, containsString("")); + assertThat(output, containsString("")); } /** diff --git a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu3Test.java index 3fe8cbcd71f..201d06e31a7 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/ca/uhn/fhir/rest/server/OperationServerWithSearchParamTypesDstu3Test.java @@ -174,18 +174,18 @@ public class OperationServerWithSearchParamTypesDstu3Test { assertThat(conf, stringContainsInOrder( "", "", - "", + "", "" )); assertThat(conf, stringContainsInOrder( "", "", - "" + "" )); assertThat(conf, stringContainsInOrder( "", "", - "" + "" )); //@formatter:on diff --git a/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/hapi/rest/server/ServerConformanceProviderDstu3Test.java b/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/hapi/rest/server/ServerConformanceProviderDstu3Test.java index 3073e649e33..8e5606eb037 100644 --- a/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/hapi/rest/server/ServerConformanceProviderDstu3Test.java +++ b/hapi-fhir-structures-dstu3/src/test/java/org/hl7/fhir/dstu3/hapi/rest/server/ServerConformanceProviderDstu3Test.java @@ -131,11 +131,10 @@ public class ServerConformanceProviderDstu3Test { ourLog.info(conf); assertEquals(1, conformance.getRest().get(0).getOperation().size()); - assertEquals("$everything", conformance.getRest().get(0).getOperation().get(0).getName()); - assertEquals("$everything", ((OperationDefinition)conformance.getRest().get(0).getOperation().get(0).getDefinition().getResource()).getCode()); + assertEquals("everything", conformance.getRest().get(0).getOperation().get(0).getName()); OperationDefinition opDef = sc.readOperationDefinition(new IdType("OperationDefinition/everything")); - assertEquals("$everything", opDef.getCode()); + assertEquals("everything", opDef.getCode()); } @Test @@ -155,7 +154,7 @@ public class ServerConformanceProviderDstu3Test { String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(opDef); ourLog.info(conf); - assertEquals("$everything", opDef.getCode()); + assertEquals("everything", opDef.getCode()); assertEquals(true, opDef.getIdempotent()); } @@ -269,15 +268,12 @@ public class ServerConformanceProviderDstu3Test { rs.init(createServletConfig()); - Conformance sconf = sc.getServerConformance(createHttpServletRequest()); - assertEquals("$plain", ((OperationDefinition)sconf.getRest().get(0).getOperation().get(0).getDefinition().getResource()).getCode()); - OperationDefinition opDef = sc.readOperationDefinition(new IdType("OperationDefinition/plain")); String conf = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(opDef); ourLog.info(conf); - assertEquals("$plain", opDef.getCode()); + assertEquals("plain", opDef.getCode()); assertEquals(true, opDef.getIdempotent()); assertEquals(3, opDef.getParameter().size()); assertEquals("start", opDef.getParameter().get(0).getName());