Testing Part 4
This commit is contained in:
parent
33cdfffa55
commit
1715574a7e
|
@ -679,14 +679,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
if (res != null) {
|
||||
return res;
|
||||
}
|
||||
Parameters p = expParameters.copy();
|
||||
p.setParameter("includeDefinition", false);
|
||||
p.setParameter("excludeNested", !hierarchical);
|
||||
|
||||
boolean cached = addDependentResources(p, vs);
|
||||
if (cached) {
|
||||
p.addParameter().setName("cache-id").setValue(new StringType(cacheId));
|
||||
}
|
||||
Parameters p = constructParameters(vs, hierarchical);
|
||||
for (ConceptSetComponent incl : vs.getCompose().getInclude()) {
|
||||
codeSystemsUsed.add(incl.getSystem());
|
||||
}
|
||||
|
@ -714,7 +707,6 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
return res;
|
||||
}
|
||||
|
||||
//TESTME
|
||||
@Override
|
||||
public ValueSetExpansionOutcome expandVS(ValueSet vs, boolean cacheOk, boolean heirarchical) {
|
||||
if (expParameters == null)
|
||||
|
@ -723,7 +715,6 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
return expandVS(vs, cacheOk, heirarchical, false, p);
|
||||
}
|
||||
|
||||
//TESTME
|
||||
@Override
|
||||
public ValueSetExpansionOutcome expandVS(ValueSet vs, boolean cacheOk, boolean heirarchical, boolean incompleteOk) {
|
||||
if (expParameters == null)
|
||||
|
@ -859,7 +850,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
for (CodingValidationRequest t : codes) {
|
||||
if (!t.hasResult()) {
|
||||
try {
|
||||
ValueSetCheckerSimple vsc = new ValueSetCheckerSimple(options, vs, this);
|
||||
ValueSetCheckerSimple vsc = constructValueSetCheckerSimple(options, vs);
|
||||
ValidationResult res = vsc.validateCode(t.getCoding());
|
||||
if (txCache != null) {
|
||||
txCache.cacheValidation(t.getCacheToken(), res, TerminologyCache.TRANSIENT);
|
||||
|
@ -890,24 +881,16 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
Bundle batch = new Bundle();
|
||||
batch.setType(BundleType.BATCH);
|
||||
Set<String> systems = new HashSet<>();
|
||||
for (CodingValidationRequest t : codes) {
|
||||
if (!t.hasResult()) {
|
||||
Parameters pIn = new Parameters();
|
||||
pIn.addParameter().setName("coding").setValue(t.getCoding());
|
||||
if (options.isGuessSystem()) {
|
||||
pIn.addParameter().setName("implySystem").setValue(new BooleanType(true));
|
||||
}
|
||||
if (vs != null) {
|
||||
pIn.addParameter().setName("valueSet").setResource(vs);
|
||||
}
|
||||
pIn.addParameter().setName("profile").setResource(expParameters);
|
||||
for (CodingValidationRequest codingValidationRequest : codes) {
|
||||
if (!codingValidationRequest.hasResult()) {
|
||||
Parameters pIn = constructParameters(options, codingValidationRequest, vs);
|
||||
setTerminologyOptions(options, pIn);
|
||||
BundleEntryComponent be = batch.addEntry();
|
||||
be.setResource(pIn);
|
||||
be.getRequest().setMethod(HTTPVerb.POST);
|
||||
be.getRequest().setUrl("CodeSystem/$validate-code");
|
||||
be.setUserData("source", t);
|
||||
systems.add(t.getCoding().getSystem());
|
||||
be.setUserData("source", codingValidationRequest);
|
||||
systems.add(codingValidationRequest.getCoding().getSystem());
|
||||
}
|
||||
}
|
||||
if (batch.getEntry().size() > 0) {
|
||||
|
@ -974,7 +957,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
if (options.isUseClient()) {
|
||||
// ok, first we try to validate locally
|
||||
try {
|
||||
ValueSetCheckerSimple vsc = new ValueSetCheckerSimple(options, vs, this, ctxt);
|
||||
ValueSetCheckerSimple vsc = constructValueSetCheckerSimple(options, vs, ctxt);
|
||||
if (!vsc.isServerSide(code.getSystem())) {
|
||||
res = vsc.validateCode(code);
|
||||
if (txCache != null) {
|
||||
|
@ -1005,12 +988,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
tlog("$validate "+csumm+" before cache exists");
|
||||
}
|
||||
try {
|
||||
Parameters pIn = new Parameters();
|
||||
pIn.addParameter().setName("coding").setValue(code);
|
||||
if (options.isGuessSystem()) {
|
||||
pIn.addParameter().setName("implySystem").setValue(new BooleanType(true));
|
||||
}
|
||||
setTerminologyOptions(options, pIn);
|
||||
Parameters pIn = constructParameters(options, code);
|
||||
res = validateOnServer(vs, pIn, options);
|
||||
} catch (Exception e) {
|
||||
res = new ValidationResult(IssueSeverity.ERROR, e.getMessage() == null ? e.getClass().getName() : e.getMessage()).setTxLink(txLog == null ? null : txLog.getLastId()).setErrorClass(TerminologyServiceErrorClass.SERVER_ERROR);
|
||||
|
@ -1022,6 +1000,56 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
return res;
|
||||
}
|
||||
|
||||
protected ValueSetCheckerSimple constructValueSetCheckerSimple( ValidationOptions options, ValueSet vs, ValidationContextCarrier ctxt) {
|
||||
return new ValueSetCheckerSimple(options, vs, this, ctxt);
|
||||
}
|
||||
|
||||
protected ValueSetCheckerSimple constructValueSetCheckerSimple( ValidationOptions options, ValueSet vs) {
|
||||
return new ValueSetCheckerSimple(options, vs, this);
|
||||
}
|
||||
|
||||
protected Parameters constructParameters(ValueSet vs, boolean hierarchical) {
|
||||
Parameters p = expParameters.copy();
|
||||
p.setParameter("includeDefinition", false);
|
||||
p.setParameter("excludeNested", !hierarchical);
|
||||
|
||||
boolean cached = addDependentResources(p, vs);
|
||||
if (cached) {
|
||||
p.addParameter().setName("cache-id").setValue(new StringType(cacheId));
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
protected Parameters constructParameters(ValidationOptions options, Coding coding) {
|
||||
Parameters pIn = new Parameters();
|
||||
pIn.addParameter().setName("coding").setValue(coding);
|
||||
if (options.isGuessSystem()) {
|
||||
pIn.addParameter().setName("implySystem").setValue(new BooleanType(true));
|
||||
}
|
||||
setTerminologyOptions(options, pIn);
|
||||
return pIn;
|
||||
}
|
||||
|
||||
protected Parameters constructParameters(ValidationOptions options, CodeableConcept codeableConcept) {
|
||||
Parameters pIn = new Parameters();
|
||||
pIn.addParameter().setName("codeableConcept").setValue(codeableConcept);
|
||||
setTerminologyOptions(options, pIn);
|
||||
return pIn;
|
||||
}
|
||||
|
||||
protected Parameters constructParameters(ValidationOptions options, CodingValidationRequest codingValidationRequest, ValueSet valueSet) {
|
||||
Parameters pIn = new Parameters();
|
||||
pIn.addParameter().setName("coding").setValue(codingValidationRequest.getCoding());
|
||||
if (options.isGuessSystem()) {
|
||||
pIn.addParameter().setName("implySystem").setValue(new BooleanType(true));
|
||||
}
|
||||
if (valueSet != null) {
|
||||
pIn.addParameter().setName("valueSet").setResource(valueSet);
|
||||
}
|
||||
pIn.addParameter().setName("profile").setResource(expParameters);
|
||||
return pIn;
|
||||
}
|
||||
|
||||
private void updateUnsupportedCodeSystems(ValidationResult res, Coding code, String codeKey) {
|
||||
if (res.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED && !code.hasVersion()) {
|
||||
unsupportedCodeSystems.add(codeKey);
|
||||
|
@ -1057,7 +1085,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
if (options.isUseClient()) {
|
||||
// ok, first we try to validate locally
|
||||
try {
|
||||
ValueSetCheckerSimple vsc = new ValueSetCheckerSimple(options, vs, this);
|
||||
ValueSetCheckerSimple vsc = constructValueSetCheckerSimple(options, vs);
|
||||
res = vsc.validateCode(code);
|
||||
txCache.cacheValidation(cacheToken, res, TerminologyCache.TRANSIENT);
|
||||
return res;
|
||||
|
@ -1078,9 +1106,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
|
|||
}
|
||||
tlog("$validate "+txCache.summary(code)+" for "+ txCache.summary(vs));
|
||||
try {
|
||||
Parameters pIn = new Parameters();
|
||||
pIn.addParameter().setName("codeableConcept").setValue(code);
|
||||
setTerminologyOptions(options, pIn);
|
||||
Parameters pIn = constructParameters(options, code);
|
||||
res = validateOnServer(vs, pIn, options);
|
||||
} catch (Exception e) {
|
||||
res = new ValidationResult(IssueSeverity.ERROR, e.getMessage() == null ? e.getClass().getName() : e.getMessage()).setTxLink(txLog.getLastId());
|
||||
|
|
|
@ -1,52 +1,250 @@
|
|||
package org.hl7.fhir.r5.context;
|
||||
|
||||
import org.hl7.fhir.exceptions.DefinitionException;
|
||||
import org.hl7.fhir.exceptions.FHIRException;
|
||||
import org.hl7.fhir.r5.formats.IParser;
|
||||
import org.hl7.fhir.r5.formats.ParserType;
|
||||
import org.hl7.fhir.r5.model.CodeableConcept;
|
||||
import org.hl7.fhir.r5.model.StructureDefinition;
|
||||
import org.hl7.fhir.r5.model.ValueSet;
|
||||
import org.hl7.fhir.r5.utils.validation.IResourceValidator;
|
||||
import org.hl7.fhir.r5.model.*;
|
||||
import org.hl7.fhir.r5.terminologies.TerminologyClient;
|
||||
import org.hl7.fhir.r5.terminologies.ValueSetCheckerSimple;
|
||||
import org.hl7.fhir.r5.terminologies.ValueSetExpander;
|
||||
import org.hl7.fhir.r5.utils.validation.ValidationContextCarrier;
|
||||
import org.hl7.fhir.utilities.npm.BasePackageCacheManager;
|
||||
import org.hl7.fhir.utilities.npm.NpmPackage;
|
||||
import org.hl7.fhir.r5.model.Coding;
|
||||
import org.hl7.fhir.utilities.ToolingClientLogger;
|
||||
import org.hl7.fhir.utilities.validation.ValidationOptions;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentMatcher;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.Spy;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.mockito.ArgumentMatchers.*;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.times;
|
||||
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class SimpleWorkerContextTests {
|
||||
@Test
|
||||
public void testValidateCodingOnServer() throws IOException {
|
||||
SimpleWorkerContext context = Mockito.spy(new SimpleWorkerContext());
|
||||
IWorkerContext.ValidationResult result = mock(IWorkerContext.ValidationResult.class);
|
||||
|
||||
Mockito.doReturn(result).when(context).validateOnServer(ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.any());
|
||||
ValidationOptions validationOptions = new ValidationOptions().guessSystem().setVersionFlexible(false);
|
||||
ValueSet valueSet = new ValueSet();
|
||||
ValidationContextCarrier ctxt = null;
|
||||
context.validateCode(validationOptions, new Coding(), valueSet, ctxt);
|
||||
@Spy
|
||||
SimpleWorkerContext context;
|
||||
|
||||
@Mock
|
||||
TerminologyCache terminologyCache;
|
||||
|
||||
@Mock
|
||||
ToolingClientLogger txLog;
|
||||
|
||||
@Mock
|
||||
TerminologyClient terminologyClient;
|
||||
|
||||
@Mock
|
||||
TerminologyCache.CacheToken cacheToken;
|
||||
|
||||
@Mock
|
||||
IWorkerContext.ValidationResult expectedValidationResult;
|
||||
|
||||
@Mock
|
||||
ValueSetExpander.ValueSetExpansionOutcome expectedExansionResult;
|
||||
|
||||
@Mock
|
||||
ValueSetCheckerSimple valueSetCheckerSimple;
|
||||
|
||||
@Mock
|
||||
Parameters pIn;
|
||||
|
||||
@Mock
|
||||
Parameters expParameters;
|
||||
|
||||
@BeforeEach
|
||||
public void beforeEach() {
|
||||
context.txCache = terminologyCache;
|
||||
context.expParameters = expParameters;
|
||||
context.txClient = terminologyClient;
|
||||
context.txLog = txLog;
|
||||
}
|
||||
|
||||
public class ValueSetMatcher implements ArgumentMatcher<ValueSet> {
|
||||
|
||||
private ValueSet left;
|
||||
|
||||
ValueSetMatcher(ValueSet left) {
|
||||
this.left = left;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(ValueSet right) {
|
||||
return left.getStatus().equals(right.getStatus())
|
||||
&& left.getCompose().equalsDeep(right.getCompose());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateCodableConceptOnServer() throws IOException {
|
||||
SimpleWorkerContext context = Mockito.spy(new SimpleWorkerContext());
|
||||
IWorkerContext.ValidationResult result = mock(IWorkerContext.ValidationResult.class);
|
||||
|
||||
Mockito.doReturn(result).when(context).validateOnServer(ArgumentMatchers.any(), ArgumentMatchers.any(), ArgumentMatchers.any());
|
||||
public void testValidateCodingWithCache() throws IOException {
|
||||
ValidationOptions validationOptions = new ValidationOptions().guessSystem().setVersionFlexible(false);
|
||||
ValueSet valueSet = new ValueSet();
|
||||
Coding coding = new Coding();
|
||||
|
||||
Mockito.doReturn(cacheToken).when(terminologyCache).generateValidationToken(validationOptions, coding, valueSet);
|
||||
Mockito.doReturn(expectedValidationResult).when(terminologyCache).getValidation(cacheToken);
|
||||
|
||||
ValidationContextCarrier ctxt = mock(ValidationContextCarrier.class);
|
||||
|
||||
IWorkerContext.ValidationResult actualValidationResult = context.validateCode(validationOptions, coding, valueSet, ctxt);
|
||||
|
||||
assertEquals(expectedValidationResult, actualValidationResult);
|
||||
|
||||
Mockito.verify(valueSetCheckerSimple, times(0)).validateCode(coding);
|
||||
Mockito.verify(terminologyCache).getValidation(cacheToken);
|
||||
Mockito.verify(terminologyCache, times(0)).cacheValidation(any(), any(), anyBoolean());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateCodingWithValueSetChecker() throws IOException {
|
||||
ValidationOptions validationOptions = new ValidationOptions().guessSystem().setVersionFlexible(false);
|
||||
ValueSet valueSet = new ValueSet();
|
||||
Coding coding = new Coding();
|
||||
|
||||
Mockito.doReturn(cacheToken).when(terminologyCache).generateValidationToken(validationOptions, coding, valueSet);
|
||||
|
||||
Mockito.doReturn(valueSetCheckerSimple).when(context).constructValueSetCheckerSimple(any(), any(), any());
|
||||
Mockito.doReturn(expectedValidationResult).when(valueSetCheckerSimple).validateCode(any(Coding.class));
|
||||
|
||||
ValidationContextCarrier ctxt = mock(ValidationContextCarrier.class);
|
||||
|
||||
IWorkerContext.ValidationResult actualValidationResult = context.validateCode(validationOptions, coding, valueSet, ctxt);
|
||||
|
||||
assertEquals(expectedValidationResult, actualValidationResult);
|
||||
|
||||
Mockito.verify(valueSetCheckerSimple).validateCode(coding);
|
||||
Mockito.verify(terminologyCache).getValidation(cacheToken);
|
||||
Mockito.verify(terminologyCache).cacheValidation(cacheToken, expectedValidationResult,false);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testValidateCodingWithServer() throws IOException {
|
||||
ValidationOptions validationOptions = new ValidationOptions().guessSystem().setVersionFlexible(false).noClient();
|
||||
ValueSet valueSet = new ValueSet();
|
||||
Coding coding = new Coding();
|
||||
|
||||
Mockito.doReturn(cacheToken).when(terminologyCache).generateValidationToken(validationOptions, coding, valueSet);
|
||||
Mockito.doReturn(pIn).when(context).constructParameters(validationOptions, coding);
|
||||
Mockito.doReturn(expectedValidationResult).when(context).validateOnServer(valueSet, pIn, validationOptions);
|
||||
|
||||
ValidationContextCarrier ctxt = mock(ValidationContextCarrier.class);
|
||||
|
||||
IWorkerContext.ValidationResult actualValidationResult = context.validateCode(validationOptions, coding, valueSet, ctxt);
|
||||
|
||||
assertEquals(expectedValidationResult, actualValidationResult);
|
||||
|
||||
Mockito.verify(valueSetCheckerSimple, times(0)).validateCode(coding);
|
||||
Mockito.verify(terminologyCache).getValidation(cacheToken);
|
||||
Mockito.verify(terminologyCache).cacheValidation(cacheToken, expectedValidationResult,true);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateCodableConceptWithCache() throws IOException {
|
||||
CodeableConcept codeableConcept = new CodeableConcept();
|
||||
ValueSet valueSet = new ValueSet();
|
||||
|
||||
Mockito.doReturn(cacheToken).when(terminologyCache).generateValidationToken(CacheTestUtils.validationOptions, codeableConcept, valueSet);
|
||||
Mockito.doReturn(expectedValidationResult).when(terminologyCache).getValidation(cacheToken);
|
||||
|
||||
IWorkerContext.ValidationResult actualValidationResult = context.validateCode(CacheTestUtils.validationOptions, codeableConcept, valueSet);
|
||||
assertEquals(expectedValidationResult, actualValidationResult);
|
||||
|
||||
Mockito.verify(valueSetCheckerSimple, times(0)).validateCode(codeableConcept);
|
||||
Mockito.verify(terminologyCache).getValidation(cacheToken);
|
||||
Mockito.verify(terminologyCache, times(0)).cacheValidation(any(), any(), anyBoolean());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testValidateCodableConceptWithValueSetChecker() throws IOException {
|
||||
Mockito.doReturn(valueSetCheckerSimple).when(context).constructValueSetCheckerSimple(any(), any());
|
||||
Mockito.doReturn(expectedValidationResult).when(valueSetCheckerSimple).validateCode(any(CodeableConcept.class));
|
||||
|
||||
CodeableConcept codeableConcept = new CodeableConcept();
|
||||
ValueSet valueSet = new ValueSet();
|
||||
|
||||
context.validateCode(validationOptions, codeableConcept, valueSet);
|
||||
Mockito.doReturn(cacheToken).when(terminologyCache).generateValidationToken(CacheTestUtils.validationOptions, codeableConcept, valueSet);
|
||||
|
||||
IWorkerContext.ValidationResult validationResultB = context.validateCode(CacheTestUtils.validationOptions, codeableConcept, valueSet);
|
||||
assertEquals(expectedValidationResult, validationResultB);
|
||||
|
||||
Mockito.verify(valueSetCheckerSimple).validateCode(codeableConcept);
|
||||
Mockito.verify(terminologyCache).cacheValidation(cacheToken, expectedValidationResult, false);
|
||||
Mockito.verify(context, times(0)).validateOnServer(any(), any(), any());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testValidateCodableConceptWithServer() throws IOException {
|
||||
|
||||
CodeableConcept codeableConcept = new CodeableConcept();
|
||||
ValueSet valueSet = new ValueSet();
|
||||
|
||||
ValidationOptions validationOptions = CacheTestUtils.validationOptions.noClient();
|
||||
Mockito.doReturn(pIn).when(context).constructParameters(validationOptions, codeableConcept);
|
||||
|
||||
Mockito.doReturn(expectedValidationResult).when(context).validateOnServer(valueSet, pIn, validationOptions);
|
||||
|
||||
Mockito.doReturn(cacheToken).when(terminologyCache).generateValidationToken(validationOptions, codeableConcept, valueSet);
|
||||
|
||||
IWorkerContext.ValidationResult validationResultB = context.validateCode(validationOptions, codeableConcept, valueSet);
|
||||
|
||||
assertEquals(expectedValidationResult, validationResultB);
|
||||
|
||||
Mockito.verify(valueSetCheckerSimple, times(0)).validateCode(codeableConcept);
|
||||
Mockito.verify(terminologyCache).cacheValidation(cacheToken, expectedValidationResult, true);
|
||||
Mockito.verify(context).validateOnServer(valueSet, pIn, validationOptions);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExpandValueSetWithCache() throws IOException {
|
||||
|
||||
ValueSet.ConceptSetComponent inc = new ValueSet.ConceptSetComponent();
|
||||
|
||||
ValueSet vs = new ValueSet();
|
||||
vs.setStatus(Enumerations.PublicationStatus.ACTIVE);
|
||||
vs.setCompose(new ValueSet.ValueSetComposeComponent());
|
||||
vs.getCompose().getInclude().add(inc);
|
||||
|
||||
Mockito.doReturn(cacheToken).when(terminologyCache).generateExpandToken(argThat(new ValueSetMatcher(vs)),eq(true));
|
||||
Mockito.doReturn(expectedExansionResult).when(terminologyCache).getExpansion(cacheToken);
|
||||
|
||||
ValueSetExpander.ValueSetExpansionOutcome actualExpansionResult = context.expandVS(inc, true);
|
||||
|
||||
assertEquals(expectedExansionResult, actualExpansionResult);
|
||||
|
||||
Mockito.verify(terminologyCache).getExpansion(cacheToken);
|
||||
Mockito.verify(terminologyCache, times(0)).cacheExpansion(any(), any(), anyBoolean());
|
||||
Mockito.verify(terminologyClient, times(0)).expandValueset(any(), any(), any());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExpandValueSetWithClient() throws IOException {
|
||||
|
||||
ValueSet.ConceptSetComponent inc = new ValueSet.ConceptSetComponent();
|
||||
|
||||
ValueSet vs = new ValueSet();
|
||||
vs.setStatus(Enumerations.PublicationStatus.ACTIVE);
|
||||
vs.setCompose(new ValueSet.ValueSetComposeComponent());
|
||||
vs.getCompose().getInclude().add(inc);
|
||||
|
||||
Mockito.doReturn(cacheToken).when(terminologyCache).generateExpandToken(argThat(new ValueSetMatcher(vs)),eq(true));
|
||||
|
||||
Mockito.doReturn(expParameters).when(context).constructParameters(argThat(new ValueSetMatcher(vs)), eq(true));
|
||||
|
||||
ValueSet expectedValueSet = new ValueSet();
|
||||
|
||||
Mockito.doReturn(expectedValueSet).when(terminologyClient).expandValueset(argThat(new ValueSetMatcher(vs)), any(), any());
|
||||
|
||||
ValueSetExpander.ValueSetExpansionOutcome actualExpansionResult = context.expandVS(inc, true);
|
||||
|
||||
assertEquals(expectedValueSet, actualExpansionResult.getValueset());
|
||||
|
||||
Mockito.verify(terminologyCache).getExpansion(cacheToken);
|
||||
Mockito.verify(terminologyCache).cacheExpansion(cacheToken, actualExpansionResult,true);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue