Added invalid test cases for DSTU3
This commit is contained in:
parent
b6d86dc5f2
commit
e6a669444d
|
@ -335,14 +335,6 @@ public class CommonCodeSystemsTerminologyService implements IValidationSupport {
|
||||||
public static String getCodeSystemUrl(@Nonnull IBaseResource theCodeSystem) {
|
public static String getCodeSystemUrl(@Nonnull IBaseResource theCodeSystem) {
|
||||||
String url;
|
String url;
|
||||||
switch (theCodeSystem.getStructureFhirVersionEnum()) {
|
switch (theCodeSystem.getStructureFhirVersionEnum()) {
|
||||||
case DSTU2_HL7ORG: {
|
|
||||||
url = ((CodeSystem) theCodeSystem).getUrl();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case DSTU3: {
|
|
||||||
url = ((org.hl7.fhir.dstu3.model.CodeSystem) theCodeSystem).getUrl();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case R4: {
|
case R4: {
|
||||||
url = ((org.hl7.fhir.r4.model.CodeSystem) theCodeSystem).getUrl();
|
url = ((org.hl7.fhir.r4.model.CodeSystem) theCodeSystem).getUrl();
|
||||||
break;
|
break;
|
||||||
|
@ -351,8 +343,7 @@ public class CommonCodeSystemsTerminologyService implements IValidationSupport {
|
||||||
url = ((org.hl7.fhir.r5.model.CodeSystem) theCodeSystem).getUrl();
|
url = ((org.hl7.fhir.r5.model.CodeSystem) theCodeSystem).getUrl();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DSTU2:
|
case DSTU3:
|
||||||
case DSTU2_1:
|
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException("Can not handle version: " + theCodeSystem.getStructureFhirVersionEnum());
|
throw new IllegalArgumentException("Can not handle version: " + theCodeSystem.getStructureFhirVersionEnum());
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,8 @@ import ca.uhn.fhir.context.FhirVersionEnum;
|
||||||
import ca.uhn.fhir.context.support.ConceptValidationOptions;
|
import ca.uhn.fhir.context.support.ConceptValidationOptions;
|
||||||
import ca.uhn.fhir.context.support.IValidationSupport;
|
import ca.uhn.fhir.context.support.IValidationSupport;
|
||||||
import ca.uhn.fhir.context.support.ValidationSupportContext;
|
import ca.uhn.fhir.context.support.ValidationSupportContext;
|
||||||
|
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
|
||||||
|
|
||||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||||
import org.hl7.fhir.r4.model.CodeSystem;
|
import org.hl7.fhir.r4.model.CodeSystem;
|
||||||
import org.hl7.fhir.r4.model.ValueSet;
|
import org.hl7.fhir.r4.model.ValueSet;
|
||||||
|
@ -13,6 +15,9 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||||
|
import static org.junit.jupiter.api.Assertions.fail;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
public class CommonCodeSystemsTerminologyServiceTest {
|
public class CommonCodeSystemsTerminologyServiceTest {
|
||||||
|
|
||||||
|
@ -114,4 +119,14 @@ public class CommonCodeSystemsTerminologyServiceTest {
|
||||||
assertEquals(null, cs);
|
assertEquals(null, cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFetchCodeSystemUrlDstu3() {
|
||||||
|
try {
|
||||||
|
CommonCodeSystemsTerminologyService.getCodeSystemUrl(new org.hl7.fhir.dstu3.model.CodeSystem());
|
||||||
|
|
||||||
|
fail();
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
assertEquals("Can not handle version: DSTU3", e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue