Rework tests which relied on old behaviour

This commit is contained in:
Tadgh 2021-03-01 14:19:20 -05:00
parent 9dd42fa605
commit 11b413ee9b
3 changed files with 7 additions and 3 deletions

View File

@ -47,6 +47,7 @@ import java.util.concurrent.TimeUnit;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -67,7 +68,7 @@ public class ServerMimetypeDstu2_1Test {
ourLog.info(content);
Conformance conf = ourCtx.newXmlParser().parseResource(Conformance.class, content);
List<String> strings = toStrings(conf.getFormat());
assertThat(strings, contains(Constants.CT_FHIR_XML, Constants.CT_FHIR_JSON));
assertThat(strings, hasItems(Constants.CT_FHIR_XML_NEW, Constants.CT_FHIR_JSON_NEW, Constants.FORMAT_XML, Constants.FORMAT_JSON));
} finally {
status.close();
}

View File

@ -47,6 +47,7 @@ import java.util.concurrent.TimeUnit;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -66,7 +67,7 @@ public class ServerMimetypeDstu3Test {
String content = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
CapabilityStatement conf = ourCtx.newXmlParser().parseResource(CapabilityStatement.class, content);
List<String> strings = toStrings(conf.getFormat());
assertThat(strings, contains(Constants.CT_FHIR_XML_NEW, Constants.CT_FHIR_JSON_NEW));
assertThat(strings, hasItems(Constants.CT_FHIR_XML_NEW, Constants.CT_FHIR_JSON_NEW, Constants.FORMAT_XML, Constants.FORMAT_JSON));
} finally {
status.close();
}

View File

@ -49,6 +49,7 @@ import java.util.concurrent.TimeUnit;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.not;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -85,12 +86,13 @@ public class ServerMimetypeR4Test {
String content = IOUtils.toString(status.getEntity().getContent(), StandardCharsets.UTF_8);
CapabilityStatement conf = ourCtx.newXmlParser().parseResource(CapabilityStatement.class, content);
List<String> strings = toStrings(conf.getFormat());
assertThat(strings, contains(Constants.CT_FHIR_XML_NEW, Constants.CT_FHIR_JSON_NEW));
assertThat(strings, hasItems(Constants.CT_FHIR_XML_NEW, Constants.CT_FHIR_JSON_NEW, Constants.FORMAT_XML, Constants.FORMAT_JSON));
} finally {
status.close();
}
}
@Test
public void testCreateWithJsonLegacyNoAcceptHeader() throws Exception {
Patient p = new Patient();