use of com.nedap.archie.rm.support.identification.TerminologyId in project openEHR_SDK by ehrbase.
the class DvCodedTextTest method testValidate_FhirCodeSystem.
@Test
void testValidate_FhirCodeSystem() throws Exception {
var codePhrase = new CodePhrase(new TerminologyId("http://hl7.org/fhir/observation-status"), "final");
// Mockito initialization
Mockito.when(fhirTerminologyValidationMock.supports("//fhir.hl7.org/CodeSystem?url=http://hl7.org/fhir/observation-status")).thenReturn(true);
Mockito.doNothing().when(fhirTerminologyValidationMock).validate("/test/dv_coded_text_fhir_code_system", "//fhir.hl7.org/CodeSystem?url=http://hl7.org/fhir/observation-status", codePhrase);
var validator = new DvCodedTextValidator(fhirTerminologyValidationMock);
var node = parseNode("/webtemplate_nodes/dv_codedtext_fhir_codesystem.json");
var result = validator.validate(new DvCodedText("Final", codePhrase), node);
assertTrue(result.isEmpty());
}
use of com.nedap.archie.rm.support.identification.TerminologyId in project openEHR_SDK by ehrbase.
the class DvCodedTextTest method testValidate_UnsupportedExternalTerminology.
@Test
void testValidate_UnsupportedExternalTerminology() throws Exception {
Mockito.when(fhirTerminologyValidationMock.supports("ICD10")).thenReturn(false);
var node = parseNode("/webtemplate_nodes/dv_codedtext_unsupported.json");
var dvCodedText = new DvCodedText("Iodine-deficiency related thyroid disorders and allied conditions", new CodePhrase(new TerminologyId("ICD10"), "E01"));
var result = new DvCodedTextValidator(fhirTerminologyValidationMock).validate(dvCodedText, node);
assertTrue(result.isEmpty());
}
use of com.nedap.archie.rm.support.identification.TerminologyId in project openEHR_SDK by ehrbase.
the class DvCodedTextTest method testValidate_FhirCodeSystem_WrongCode.
@Test
void testValidate_FhirCodeSystem_WrongCode() throws Exception {
var codePhrase = new CodePhrase(new TerminologyId("http://hl7.org/fhir/observation-status"), "casual");
// Mockito initialization
Mockito.when(fhirTerminologyValidationMock.supports("//fhir.hl7.org/CodeSystem?url=http://hl7.org/fhir/observation-status")).thenReturn(true);
Mockito.doThrow(new ConstraintViolationException(List.of(new ConstraintViolation("/test/dv_coded_text_fhir_code_system", "The specified code 'casual' is not known to belong to the specified code system 'http://hl7.org/fhir/observation-status'")))).when(fhirTerminologyValidationMock).validate("/test/dv_coded_text_fhir_code_system", "//fhir.hl7.org/CodeSystem?url=http://hl7.org/fhir/observation-status", codePhrase);
var validator = new DvCodedTextValidator(fhirTerminologyValidationMock);
var node = parseNode("/webtemplate_nodes/dv_codedtext_fhir_codesystem.json");
var result = validator.validate(new DvCodedText("Casual", codePhrase), node);
assertEquals(1, result.size());
}
use of com.nedap.archie.rm.support.identification.TerminologyId in project openEHR_SDK by ehrbase.
the class TerminologyCheckTest method testSimpleValidationLanguage.
@Test
public void testSimpleValidationLanguage() throws Exception {
CodePhrase codePhrase = new CodePhrase(new TerminologyId("ISO_3166-1"), "AU");
org.ehrbase.validation.terminology.validator.CodePhrase.validate(localizedTerminologies.getDefault(), codesetMapping, "territory", codePhrase);
org.ehrbase.validation.terminology.validator.CodePhrase.validate(localizedTerminologies.getDefault(), codesetMapping, null, codePhrase);
}
use of com.nedap.archie.rm.support.identification.TerminologyId in project openEHR_SDK by ehrbase.
the class TerminologyCheckTest method testSimpleValidationSymbol.
@Test
public void testSimpleValidationSymbol() {
DvCodedText symbol = new DvCodedText("autogenerated (node doesn't have a constraint)", new CodePhrase(new TerminologyId("http://hl7.org/fhir/contact-point-use"), "BCDWXMEORP"));
org.ehrbase.validation.terminology.validator.DvOrdinal.validate(localizedTerminologies.locale("en"), codesetMapping, "symbol", symbol, "en");
}
Aggregations