Add assertions to test case

This commit is contained in:
dotasek 2022-02-25 13:11:24 -05:00
parent baac4ac1a8
commit f2e9f1247b
1 changed files with 14 additions and 2 deletions

View File

@ -1,15 +1,22 @@
package org.hl7.fhir.dstu3.utils; package org.hl7.fhir.dstu3.utils;
import org.hl7.fhir.dstu3.context.IWorkerContext; import org.hl7.fhir.dstu3.context.IWorkerContext;
import org.hl7.fhir.dstu3.model.Base; import org.hl7.fhir.dstu3.model.Base;
import org.hl7.fhir.dstu3.model.ExpressionNode; import org.hl7.fhir.dstu3.model.ExpressionNode;
import org.hl7.fhir.dstu3.model.StringType;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith; import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock; import org.mockito.Mock;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.mockito.junit.jupiter.MockitoExtension; import org.mockito.junit.jupiter.MockitoExtension;
import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.times;
@ExtendWith(MockitoExtension.class) @ExtendWith(MockitoExtension.class)
public class FhirPathTests { public class FhirPathTests {
@ -43,7 +50,12 @@ public class FhirPathTests {
expressionNode.getParameters().add(expressionNodeB); expressionNode.getParameters().add(expressionNodeB);
expressionNode.getParameters().add(expressionNodeC); expressionNode.getParameters().add(expressionNodeC);
engine.evaluate(appContext, resource, base, expressionNode); List<Base> result = engine.evaluate(appContext, resource, base, expressionNode);
assertEquals(1, result.size());
Base onlyResult = result.get(0);
assertTrue(onlyResult instanceof StringType);
assertEquals("base", ((StringType)result.get(0)).asStringValue());
Mockito.verify(engine, times(2)).convertToString(any());
} }
} }