Fix IPS generation tests expecting old composition narrative

This commit is contained in:
dotasek 2024-01-19 12:52:23 -05:00
parent c2a068617d
commit 502b071e4d
2 changed files with 9 additions and 5 deletions

View File

@ -45,6 +45,7 @@ import java.util.stream.Collectors;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.matchesPattern;
import static org.hamcrest.Matchers.stringContainsInOrder;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -233,9 +234,8 @@ public class IpsGenerationR4Test extends BaseResourceProviderR4Test {
ourLog.info("Output: {}", myFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(output));
Composition composition = findCompositionSectionByDisplay(output, "History of Immunization Narrative");
// Should be newest first
assertThat(composition.getText().getDivAsString(), stringContainsInOrder(
"Vax 2015", "Vax 2010", "Vax 2005"
assertThat(composition.getText().getDivAsString(), is(
"<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>International Patient Summary Document</h1></div>"
));
List<String> resourceDates = output
@ -245,6 +245,7 @@ public class IpsGenerationR4Test extends BaseResourceProviderR4Test {
.map(t -> (Immunization) t.getResource())
.map(t -> t.getOccurrenceDateTimeType().getValueAsString().substring(0, 4))
.collect(Collectors.toList());
// Should be newest first
assertThat(resourceDates, contains("2015", "2010", "2005"));
}

View File

@ -72,6 +72,7 @@ import static ca.uhn.fhir.jpa.ips.generator.IpsGenerationR4Test.findEntryResourc
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.jupiter.api.Assertions.assertEquals;
@ -157,8 +158,10 @@ public class IpsGeneratorSvcImplTest {
// Composition itself should also have a narrative
String compositionNarrative = composition.getText().getDivAsString();
ourLog.info("Composition narrative: {}", compositionNarrative);
assertThat(compositionNarrative, containsString("Allergies and Intolerances"));
assertThat(compositionNarrative, not(containsString("Pregnancy")));
assertThat(compositionNarrative, is(
"<div xmlns=\"http://www.w3.org/1999/xhtml\"><h1>International Patient Summary Document</h1></div>"
));
}