Search in sources :

Example 6 with Code

use of com.b2international.snowowl.fhir.core.model.dt.Code in project snow-owl by b2ihealthcare.

the class SimpleQuantityTest method build.

@Test
public void build() throws Exception {
    assertEquals(Double.valueOf(12.3), quantity.getValue());
    assertEquals("mg", quantity.getUnit());
    assertEquals(new Uri("uri:LOINC"), quantity.getSystem());
    assertEquals(new Code("code"), quantity.getCode());
}
Also used : Uri(com.b2international.snowowl.fhir.core.model.dt.Uri) OperationOutcomeCode(com.b2international.snowowl.fhir.core.codesystems.OperationOutcomeCode) Code(com.b2international.snowowl.fhir.core.model.dt.Code) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 7 with Code

use of com.b2international.snowowl.fhir.core.model.dt.Code in project snow-owl by b2ihealthcare.

the class RangeTest method deserialize.

@Test
public void deserialize() throws Exception {
    Range readRange = objectMapper.readValue(objectMapper.writeValueAsString(range), Range.class);
    assertEquals("id", readRange.getId());
    SimpleQuantity low = readRange.getLow();
    assertEquals(Double.valueOf(12.3), low.getValue());
    assertEquals("mg", low.getUnit());
    assertEquals(new Code("code1"), low.getCode());
    SimpleQuantity high = range.getHigh();
    assertEquals(Double.valueOf(120.3), high.getValue());
    assertEquals("mg", high.getUnit());
    assertEquals(new Code("code2"), high.getCode());
}
Also used : SimpleQuantity(com.b2international.snowowl.fhir.core.model.dt.SimpleQuantity) Range(com.b2international.snowowl.fhir.core.model.dt.Range) Code(com.b2international.snowowl.fhir.core.model.dt.Code) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 8 with Code

use of com.b2international.snowowl.fhir.core.model.dt.Code in project snow-owl by b2ihealthcare.

the class CodingTest method deserializeFromJson.

@Test
public void deserializeFromJson() throws Exception {
    String jsonCoding = "{\"code\":\"1234\"," + "\"system\":\"http://snomed.info/sct/version/20180131\"," + "\"userSelected\":false}";
    Coding coding = objectMapper.readValue(jsonCoding, Coding.class);
    Assert.assertEquals(new Code("1234"), coding.getCode());
    Assert.assertEquals(new Uri("http://snomed.info/sct/version/20180131"), coding.getSystem());
}
Also used : Coding(com.b2international.snowowl.fhir.core.model.dt.Coding) OperationOutcomeCode(com.b2international.snowowl.fhir.core.codesystems.OperationOutcomeCode) Code(com.b2international.snowowl.fhir.core.model.dt.Code) Uri(com.b2international.snowowl.fhir.core.model.dt.Uri) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 9 with Code

use of com.b2international.snowowl.fhir.core.model.dt.Code in project snow-owl by b2ihealthcare.

the class IncludeTest method validate.

private void validate(Include include) {
    assertEquals(new Uri("system"), include.getSystem());
    assertEquals("version", include.getVersion());
    assertEquals("valueSetUri", include.getValueSets().iterator().next().getUriValue());
    ValueSetFilter filter = include.getFilters().iterator().next();
    assertEquals(new Code("filterProperty"), filter.getProperty());
    assertEquals(FilterOperator.EQUALS.getCode(), filter.getOperator());
    assertEquals(new Code("1234567"), filter.getValue());
    ValueSetConcept concept = include.getConcepts().iterator().next();
    assertEquals("code", concept.getCode().getCodeValue());
    assertEquals("display", concept.getDisplay());
    Designation designation = concept.getDesignations().iterator().next();
    assertEquals("gb_en", designation.getLanguage());
    assertEquals("designationValue", designation.getValue());
    assertEquals("internal", designation.getUse().getCode().getCodeValue());
}
Also used : Designation(com.b2international.snowowl.fhir.core.model.Designation) ValueSetFilter(com.b2international.snowowl.fhir.core.model.valueset.ValueSetFilter) ValueSetConcept(com.b2international.snowowl.fhir.core.model.valueset.ValueSetConcept) Uri(com.b2international.snowowl.fhir.core.model.dt.Uri) Code(com.b2international.snowowl.fhir.core.model.dt.Code)

Example 10 with Code

use of com.b2international.snowowl.fhir.core.model.dt.Code in project snow-owl by b2ihealthcare.

the class ValueSetFilterTest method validate.

private void validate(ValueSetFilter filter) {
    assertEquals(FilterOperator.EQUALS.getCode(), filter.getOperator());
    assertEquals(new Code("1234567"), filter.getValue());
    assertEquals(new Code("filterProperty"), filter.getProperty());
}
Also used : Code(com.b2international.snowowl.fhir.core.model.dt.Code)

Aggregations

Code (com.b2international.snowowl.fhir.core.model.dt.Code)22 FhirTest (com.b2international.snowowl.fhir.tests.FhirTest)13 Test (org.junit.Test)13 Uri (com.b2international.snowowl.fhir.core.model.dt.Uri)11 OperationOutcomeCode (com.b2international.snowowl.fhir.core.codesystems.OperationOutcomeCode)4 BatchRequest (com.b2international.snowowl.fhir.core.model.BatchRequest)3 SimpleQuantity (com.b2international.snowowl.fhir.core.model.dt.SimpleQuantity)3 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)3 HttpEntity (org.springframework.http.HttpEntity)3 HttpHeaders (org.springframework.http.HttpHeaders)3 RestTemplate (org.springframework.web.client.RestTemplate)3 SnowOwlConfiguration (com.b2international.snowowl.core.config.SnowOwlConfiguration)2 SnowOwlOpenApiWebMvcResource (com.b2international.snowowl.core.rest.SnowOwlOpenApiWebMvcResource)2 Designation (com.b2international.snowowl.fhir.core.model.Designation)2 OperationDefinition (com.b2international.snowowl.fhir.core.model.operationdefinition.OperationDefinition)2 StringUtils (com.b2international.commons.StringUtils)1 NotFoundException (com.b2international.commons.exceptions.NotFoundException)1 ApplicationContext (com.b2international.snowowl.core.ApplicationContext)1 CoreActivator (com.b2international.snowowl.core.CoreActivator)1 FhirApiConfig (com.b2international.snowowl.core.rest.FhirApiConfig)1