Test fixes

This commit is contained in:
James Agnew 2019-03-11 16:14:34 -04:00
parent 71a07c0239
commit 3433ecfd14
4 changed files with 14 additions and 14 deletions

View File

@ -46,7 +46,7 @@ public class DefaultThymeleafNarrativeGeneratorDstu3Test {
@Before @Before
public void before() { public void before() {
myGen = new DefaultThymeleafNarrativeGenerator(ourCtx); myGen = new DefaultThymeleafNarrativeGenerator();
myGen.setUseHapiServerConformanceNarrative(true); myGen.setUseHapiServerConformanceNarrative(true);
ourCtx.setNarrativeGenerator(myGen); ourCtx.setNarrativeGenerator(myGen);
@ -71,7 +71,7 @@ public class DefaultThymeleafNarrativeGeneratorDstu3Test {
value.setBirthDate(new Date()); value.setBirthDate(new Date());
myGen.populateResourceNarrative(value); myGen.populateResourceNarrative(ourCtx, value);
String output = value.getText().getDiv().getValueAsString(); String output = value.getText().getDiv().getValueAsString();
ourLog.info(output); ourLog.info(output);
assertThat(output, StringContains.containsString("<div class=\"hapiHeaderText\">joe john <b>BLOW </b></div>")); assertThat(output, StringContains.containsString("<div class=\"hapiHeaderText\">joe john <b>BLOW </b></div>"));
@ -80,7 +80,7 @@ public class DefaultThymeleafNarrativeGeneratorDstu3Test {
@Test @Test
public void testTranslations() throws DataFormatException { public void testTranslations() throws DataFormatException {
CustomThymeleafNarrativeGenerator customGen = new CustomThymeleafNarrativeGenerator(ourCtx, "classpath:/testnarrative.properties"); CustomThymeleafNarrativeGenerator customGen = new CustomThymeleafNarrativeGenerator("classpath:/testnarrative.properties");
FhirContext ctx = FhirContext.forDstu3(); FhirContext ctx = FhirContext.forDstu3();
ctx.setNarrativeGenerator(customGen); ctx.setNarrativeGenerator(customGen);
@ -114,7 +114,7 @@ public class DefaultThymeleafNarrativeGeneratorDstu3Test {
} }
}); });
customGen.populateResourceNarrative(value); customGen.populateResourceNarrative(ourCtx, value);
String output = value.getText().getDiv().getValueAsString(); String output = value.getText().getDiv().getValueAsString();
ourLog.info(output); ourLog.info(output);
assertThat(output, StringContains.containsString("Some beautiful proze")); assertThat(output, StringContains.containsString("Some beautiful proze"));
@ -130,7 +130,7 @@ public class DefaultThymeleafNarrativeGeneratorDstu3Test {
value.addResult().setReference("Observation/2"); value.addResult().setReference("Observation/2");
value.addResult().setReference("Observation/3"); value.addResult().setReference("Observation/3");
myGen.populateResourceNarrative(value); myGen.populateResourceNarrative(ourCtx, value);
String output = value.getText().getDiv().getValueAsString(); String output = value.getText().getDiv().getValueAsString();
ourLog.info(output); ourLog.info(output);
@ -158,7 +158,7 @@ public class DefaultThymeleafNarrativeGeneratorDstu3Test {
// ourLog.info(output); // ourLog.info(output);
// assertEquals("Operation Outcome (2 issues)", output); // assertEquals("Operation Outcome (2 issues)", output);
myGen.populateResourceNarrative(oo); myGen.populateResourceNarrative(ourCtx, oo);
String output = oo.getText().getDiv().getValueAsString(); String output = oo.getText().getDiv().getValueAsString();
ourLog.info(output); ourLog.info(output);
@ -197,7 +197,7 @@ public class DefaultThymeleafNarrativeGeneratorDstu3Test {
value.addResult().setResource(obs); value.addResult().setResource(obs);
} }
myGen.populateResourceNarrative(value); myGen.populateResourceNarrative(ourCtx, value);
String output = value.getText().getDiv().getValueAsString(); String output = value.getText().getDiv().getValueAsString();
ourLog.info(output); ourLog.info(output);
@ -217,7 +217,7 @@ public class DefaultThymeleafNarrativeGeneratorDstu3Test {
mp.setStatus(MedicationRequestStatus.ACTIVE); mp.setStatus(MedicationRequestStatus.ACTIVE);
mp.setAuthoredOnElement(new DateTimeType("2014-09-01")); mp.setAuthoredOnElement(new DateTimeType("2014-09-01"));
myGen.populateResourceNarrative(mp); myGen.populateResourceNarrative(ourCtx, mp);
String output = mp.getText().getDiv().getValueAsString(); String output = mp.getText().getDiv().getValueAsString();
assertTrue("Expected medication name of ciprofloaxin within narrative: "+output, output.contains("ciprofloaxin")); assertTrue("Expected medication name of ciprofloaxin within narrative: "+output, output.contains("ciprofloaxin"));
@ -230,7 +230,7 @@ public class DefaultThymeleafNarrativeGeneratorDstu3Test {
Medication med = new Medication(); Medication med = new Medication();
med.getCode().setText("ciproflaxin"); med.getCode().setText("ciproflaxin");
myGen.populateResourceNarrative(med); myGen.populateResourceNarrative(ourCtx, med);
String output = med.getText().getDiv().getValueAsString(); String output = med.getText().getDiv().getValueAsString();
assertThat(output, containsString("ciproflaxin")); assertThat(output, containsString("ciproflaxin"));

View File

@ -64,7 +64,7 @@ public class BundleTypeInResponseHl7OrgTest {
ServletHandler proxyHandler = new ServletHandler(); ServletHandler proxyHandler = new ServletHandler();
RestfulServer servlet = new RestfulServer(ourCtx); RestfulServer servlet = new RestfulServer(ourCtx);
servlet.getFhirContext().setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator(ourCtx)); servlet.getFhirContext().setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator());
servlet.setResourceProviders(patientProvider); servlet.setResourceProviders(patientProvider);
ServletHolder servletHolder = new ServletHolder(servlet); ServletHolder servletHolder = new ServletHolder(servlet);
@ -83,7 +83,7 @@ public class BundleTypeInResponseHl7OrgTest {
@Search @Search
public List<Patient> findPatient() { public List<Patient> findPatient() {
ArrayList<Patient> retVal = new ArrayList<Patient>(); ArrayList<Patient> retVal = new ArrayList<>();
Patient patient = new Patient(); Patient patient = new Patient();
patient.setId("1"); patient.setId("1");

View File

@ -449,7 +449,7 @@ public class DateRangeParamR4Test {
ServletHandler proxyHandler = new ServletHandler(); ServletHandler proxyHandler = new ServletHandler();
RestfulServer servlet = new RestfulServer(ourCtx); RestfulServer servlet = new RestfulServer(ourCtx);
servlet.getFhirContext().setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator(ourCtx)); servlet.getFhirContext().setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator());
servlet.setResourceProviders(patientProvider); servlet.setResourceProviders(patientProvider);
ServletHolder servletHolder = new ServletHolder(servlet); ServletHolder servletHolder = new ServletHolder(servlet);

View File

@ -474,7 +474,7 @@ public class SearchSearchServerDstu1Test {
ServletHandler proxyHandler = new ServletHandler(); ServletHandler proxyHandler = new ServletHandler();
ourServlet = new RestfulServer(ourCtx); ourServlet = new RestfulServer(ourCtx);
ourServlet.getFhirContext().setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator(ourCtx)); ourServlet.getFhirContext().setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator());
ourServlet.setPagingProvider(new FifoMemoryPagingProvider(10).setDefaultPageSize(10)); ourServlet.setPagingProvider(new FifoMemoryPagingProvider(10).setDefaultPageSize(10));
ourServlet.setResourceProviders(patientProvider, new DummyObservationResourceProvider()); ourServlet.setResourceProviders(patientProvider, new DummyObservationResourceProvider());
@ -517,7 +517,7 @@ public class SearchSearchServerDstu1Test {
@Search(compartmentName = "fooCompartment") @Search(compartmentName = "fooCompartment")
public List<Patient> compartment(@IdParam IdType theId) { public List<Patient> compartment(@IdParam IdType theId) {
ArrayList<Patient> retVal = new ArrayList<Patient>(); ArrayList<Patient> retVal = new ArrayList<>();
Patient patient = new Patient(); Patient patient = new Patient();
patient.setId(theId); patient.setId(theId);