Fixed JUnit tests.

This commit is contained in:
ianmarshall 2020-09-15 22:05:46 -04:00
parent ca0bdc8e4c
commit b2b63cbb02
5 changed files with 19 additions and 209 deletions

View File

@ -395,7 +395,11 @@ public abstract class BaseTermReadSvcImpl implements ITermReadSvc {
optionalTermValueSet = myValueSetDao.findTermValueSetByUrlAndVersion(theValueSetToExpand.getUrl(), theValueSetToExpand.getVersion()); optionalTermValueSet = myValueSetDao.findTermValueSetByUrlAndVersion(theValueSetToExpand.getUrl(), theValueSetToExpand.getVersion());
} else { } else {
List<TermValueSet> termValueSets = myValueSetDao.findTermValueSetByUrl(PageRequest.of(0, 1), theValueSetToExpand.getUrl()); List<TermValueSet> termValueSets = myValueSetDao.findTermValueSetByUrl(PageRequest.of(0, 1), theValueSetToExpand.getUrl());
optionalTermValueSet = Optional.of(termValueSets.get(0)); if (termValueSets.size() > 0) {
optionalTermValueSet = Optional.of(termValueSets.get(0));
} else {
optionalTermValueSet = Optional.empty();
}
} }
} else { } else {
optionalTermValueSet = Optional.empty(); optionalTermValueSet = Optional.empty();

View File

@ -61,7 +61,7 @@ public class FhirResourceDaoR4CodeSystemTest extends BaseJpaR4Test {
// Now the background scheduler will do its thing // Now the background scheduler will do its thing
myTerminologyDeferredStorageSvc.saveDeferred(); myTerminologyDeferredStorageSvc.saveDeferred();
runInTransaction(() -> { runInTransaction(() -> {
assertEquals(0, myTermCodeSystemDao.count()); assertEquals(1, myTermCodeSystemDao.count());
assertEquals(0, myTermCodeSystemVersionDao.count()); assertEquals(0, myTermCodeSystemVersionDao.count());
assertEquals(0, myTermConceptDao.count()); assertEquals(0, myTermConceptDao.count());
}); });
@ -155,7 +155,7 @@ public class FhirResourceDaoR4CodeSystemTest extends BaseJpaR4Test {
// The remaining versions and Code System entities should be gone now. // The remaining versions and Code System entities should be gone now.
runInTransaction(() -> { runInTransaction(() -> {
assertEquals(0, myTermCodeSystemDao.count()); assertEquals(1, myTermCodeSystemDao.count());
assertNull(myTermCodeSystemDao.findByCodeSystemUri("http://foo")); assertNull(myTermCodeSystemDao.findByCodeSystemUri("http://foo"));
assertEquals(0, myTermCodeSystemVersionDao.count()); assertEquals(0, myTermCodeSystemVersionDao.count());
List<ResourceTable> resourceList = myResourceTableDao.findAll(); List<ResourceTable> resourceList = myResourceTableDao.findAll();

View File

@ -31,10 +31,18 @@ public class ResourceProviderR4CodeSystemVersionedTest extends BaseResourceProvi
@BeforeEach @BeforeEach
@Transactional @Transactional
public void before02() throws IOException { public void before02() throws IOException {
CodeSystem cs = loadResourceFromClasspath(CodeSystem.class, "/extensional-case-3-cs-v1.xml"); CodeSystem cs = loadResourceFromClasspath(CodeSystem.class, "/extensional-case-3-cs.xml");
cs.setVersion("1");
for(CodeSystem.ConceptDefinitionComponent conceptDefinitionComponent : cs.getConcept()) {
conceptDefinitionComponent.setDisplay(conceptDefinitionComponent.getDisplay() + " v1");
}
myCodeSystemDao.create(cs, mySrd); myCodeSystemDao.create(cs, mySrd);
cs = loadResourceFromClasspath(CodeSystem.class, "/extensional-case-3-cs-v2.xml"); cs = loadResourceFromClasspath(CodeSystem.class, "/extensional-case-3-cs.xml");
cs.setVersion("2");
for(CodeSystem.ConceptDefinitionComponent conceptDefinitionComponent : cs.getConcept()) {
conceptDefinitionComponent.setDisplay(conceptDefinitionComponent.getDisplay() + " v2");
}
myCodeSystemDao.create(cs, mySrd); myCodeSystemDao.create(cs, mySrd);
CodeSystem parentChildCs = new CodeSystem(); CodeSystem parentChildCs = new CodeSystem();
@ -310,7 +318,7 @@ public class ResourceProviderR4CodeSystemVersionedTest extends BaseResourceProvi
assertEquals("version", respParam.getParameter().get(1).getName()); assertEquals("version", respParam.getParameter().get(1).getName());
assertEquals("1", ((StringType) respParam.getParameter().get(1).getValue()).getValue()); assertEquals("1", ((StringType) respParam.getParameter().get(1).getValue()).getValue());
assertEquals("display", respParam.getParameter().get(2).getName()); assertEquals("display", respParam.getParameter().get(2).getName());
assertEquals(("Systolic blood pressure--expiration"), ((StringType) respParam.getParameter().get(2).getValue()).getValue()); assertEquals(("Systolic blood pressure--expiration v1"), ((StringType) respParam.getParameter().get(2).getValue()).getValue());
assertEquals("abstract", respParam.getParameter().get(3).getName()); assertEquals("abstract", respParam.getParameter().get(3).getName());
assertEquals(false, ((BooleanType) respParam.getParameter().get(3).getValue()).getValue()); assertEquals(false, ((BooleanType) respParam.getParameter().get(3).getValue()).getValue());
@ -392,7 +400,7 @@ public class ResourceProviderR4CodeSystemVersionedTest extends BaseResourceProvi
assertEquals("version", respParam.getParameter().get(1).getName()); assertEquals("version", respParam.getParameter().get(1).getName());
assertEquals("1", ((StringType) respParam.getParameter().get(1).getValue()).getValue()); assertEquals("1", ((StringType) respParam.getParameter().get(1).getValue()).getValue());
assertEquals("display", respParam.getParameter().get(2).getName()); assertEquals("display", respParam.getParameter().get(2).getName());
assertEquals(("Systolic blood pressure--expiration"), ((StringType) respParam.getParameter().get(2).getValue()).getValue()); assertEquals(("Systolic blood pressure--expiration v1"), ((StringType) respParam.getParameter().get(2).getValue()).getValue());
assertEquals("abstract", respParam.getParameter().get(3).getName()); assertEquals("abstract", respParam.getParameter().get(3).getName());
assertEquals(false, ((BooleanType) respParam.getParameter().get(3).getValue()).getValue()); assertEquals(false, ((BooleanType) respParam.getParameter().get(3).getValue()).getValue());

View File

@ -1,101 +0,0 @@
<CodeSystem xmlns="http://hl7.org/fhir">
<url value="http://acme.org" />
<version value="1"/>
<name value="ACME Codes" />
<concept>
<code value="8450-9" />
<display value="Systolic blood pressure--expiration" />
</concept>
<concept>
<code value="11378-7" />
<display value="Systolic blood pressure at First encounter" />
</concept>
<concept>
<code value="8493-9" />
<display value="Systolic blood pressure 10 hour minimum" />
</concept>
<concept>
<code value="8494-7" />
<display value="Systolic blood pressure 12 hour minimum" />
</concept>
<concept>
<code value="8495-4" />
<display value="Systolic blood pressure 24 hour minimum" />
</concept>
<concept>
<code value="8451-7" />
<display value="Systolic blood pressure--inspiration" />
</concept>
<concept>
<code value="8452-5" />
<display value="Systolic blood pressure.inspiration - expiration" />
</concept>
<concept>
<code value="8459-0" />
<display value="Systolic blood pressure--sitting" />
</concept>
<concept>
<code value="8460-8" />
<display value="Systolic blood pressure--standing" />
</concept>
<concept>
<code value="8461-6" />
<display value="Systolic blood pressure--supine" />
</concept>
<concept>
<code value="8479-8" />
<display value="Systolic blood pressure by palpation" />
</concept>
<concept>
<code value="8480-6" />
<display value="Systolic blood pressure" />
</concept>
<concept>
<code value="8481-4" />
<display value="Systolic blood pressure 1 hour maximum" />
</concept>
<concept>
<code value="8482-2" />
<display value="Systolic blood pressure 8 hour maximum" />
</concept>
<concept>
<code value="8483-0" />
<display value="Systolic blood pressure 10 hour maximum" />
</concept>
<concept>
<code value="8484-8" />
<display value="Systolic blood pressure 12 hour maximum" />
</concept>
<concept>
<code value="8485-5" />
<display value="Systolic blood pressure 24 hour maximum" />
</concept>
<concept>
<code value="8486-3" />
<display value="Systolic blood pressure 1 hour mean" />
</concept>
<concept>
<code value="8487-1" />
<display value="Systolic blood pressure 8 hour mean" />
</concept>
<concept>
<code value="8488-9" />
<display value="Systolic blood pressure 10 hour mean" />
</concept>
<concept>
<code value="8489-7" />
<display value="Systolic blood pressure 12 hour mean" />
</concept>
<concept>
<code value="8490-5" />
<display value="Systolic blood pressure 24 hour mean" />
</concept>
<concept>
<code value="8491-3" />
<display value="Systolic blood pressure 1 hour minimum" />
</concept>
<concept>
<code value="8492-1" />
<display value="Systolic blood pressure 8 hour minimum" />
</concept>
</CodeSystem>

View File

@ -1,101 +0,0 @@
<CodeSystem xmlns="http://hl7.org/fhir">
<url value="http://acme.org" />
<version value="2"/>
<name value="ACME Codes" />
<concept>
<code value="8450-9" />
<display value="Systolic blood pressure--expiration v2" />
</concept>
<concept>
<code value="11378-7" />
<display value="Systolic blood pressure at First encounter v2" />
</concept>
<concept>
<code value="8493-9" />
<display value="Systolic blood pressure 10 hour minimum v2" />
</concept>
<concept>
<code value="8494-7" />
<display value="Systolic blood pressure 12 hour minimum v2" />
</concept>
<concept>
<code value="8495-4" />
<display value="Systolic blood pressure 24 hour minimum v2" />
</concept>
<concept>
<code value="8451-7" />
<display value="Systolic blood pressure--inspiration v2" />
</concept>
<concept>
<code value="8452-5" />
<display value="Systolic blood pressure.inspiration - expiration v2" />
</concept>
<concept>
<code value="8459-0" />
<display value="Systolic blood pressure--sitting v2" />
</concept>
<concept>
<code value="8460-8" />
<display value="Systolic blood pressure--standing v2" />
</concept>
<concept>
<code value="8461-6" />
<display value="Systolic blood pressure--supine v2" />
</concept>
<concept>
<code value="8479-8" />
<display value="Systolic blood pressure by palpation v2" />
</concept>
<concept>
<code value="8480-6" />
<display value="Systolic blood pressure v2" />
</concept>
<concept>
<code value="8481-4" />
<display value="Systolic blood pressure 1 hour maximum v2" />
</concept>
<concept>
<code value="8482-2" />
<display value="Systolic blood pressure 8 hour maximum v2" />
</concept>
<concept>
<code value="8483-0" />
<display value="Systolic blood pressure 10 hour maximum v2" />
</concept>
<concept>
<code value="8484-8" />
<display value="Systolic blood pressure 12 hour maximum v2" />
</concept>
<concept>
<code value="8485-5" />
<display value="Systolic blood pressure 24 hour maximum v2" />
</concept>
<concept>
<code value="8486-3" />
<display value="Systolic blood pressure 1 hour mean v2" />
</concept>
<concept>
<code value="8487-1" />
<display value="Systolic blood pressure 8 hour mean v2" />
</concept>
<concept>
<code value="8488-9" />
<display value="Systolic blood pressure 10 hour mean v2" />
</concept>
<concept>
<code value="8489-7" />
<display value="Systolic blood pressure 12 hour mean v2" />
</concept>
<concept>
<code value="8490-5" />
<display value="Systolic blood pressure 24 hour mean v2" />
</concept>
<concept>
<code value="8491-3" />
<display value="Systolic blood pressure 1 hour minimum v2" />
</concept>
<concept>
<code value="8492-1" />
<display value="Systolic blood pressure 8 hour minimum v2" />
</concept>
</CodeSystem>