From 3cd7c8a61c55765f36af98c1c4401d599a045364 Mon Sep 17 00:00:00 2001 From: James Date: Tue, 31 Oct 2017 20:38:26 -0400 Subject: [PATCH] Fix tests to work on Windows --- .../jpa/provider/r4/GraphQLProviderR4Test.java | 9 +++++---- .../fhir/rest/server/GraphQLR4ProviderTest.java | 14 +++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java index eb3a24a687f..286c6d9ce0b 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java @@ -1,5 +1,6 @@ package ca.uhn.fhir.jpa.provider.r4; +import ca.uhn.fhir.util.TestUtil; import ca.uhn.fhir.util.UrlUtil; import org.apache.commons.io.IOUtils; import org.apache.http.client.methods.CloseableHttpResponse; @@ -30,14 +31,14 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test { try { String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); ourLog.info(resp); - assertEquals(resp, "{\n" + + assertEquals(TestUtil.stripReturns(resp), TestUtil.stripReturns("{\n" + " \"name\":[{\n" + " \"family\":\"FAM\",\n" + " \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" + " },{\n" + " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + " }]\n" + - "}"); + "}")); } finally { IOUtils.closeQuietly(response); } @@ -55,7 +56,7 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test { try { String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); ourLog.info(resp); - assertEquals(resp, "{\n" + + assertEquals(TestUtil.stripReturns(resp), TestUtil.stripReturns("{\n" + " \"PatientList\":[{\n" + " \"name\":[{\n" + " \"family\":\"FAM\",\n" + @@ -68,7 +69,7 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test { " \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" + " }]\n" + " }]\n" + - "}"); + "}")); } finally { IOUtils.closeQuietly(response); } diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/GraphQLR4ProviderTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/GraphQLR4ProviderTest.java index c47511be828..973835eb88f 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/GraphQLR4ProviderTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/server/GraphQLR4ProviderTest.java @@ -61,13 +61,13 @@ public class GraphQLR4ProviderTest { ourLog.info(responseContent); assertEquals(200, status.getStatusLine().getStatusCode()); - assertEquals(TestUtil.stripReturns("{" + - " \"name\":[{" + - " \"family\":\"FAMILY\"," + - " \"given\":[\"GIVEN1\",\"GIVEN2\"]" + - " },{" + - " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]" + - " }]" + + assertEquals(TestUtil.stripReturns("{\n" + + " \"name\":[{\n" + + " \"family\":\"FAMILY\",\n" + + " \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" + + " },{\n" + + " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + + " }]\n" + "}"), TestUtil.stripReturns(responseContent)); assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json"));