Search in sources :

Example 1 with SimpleQuantity

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

the class RangeUsageContextTest method validate.

private void validate(RangeUsageContext usageContext) {
    assertEquals("usageContextId", usageContext.getId());
    assertEquals("coding", usageContext.getCode().getCodeValue());
    SimpleQuantity low = usageContext.getValue().getLow();
    assertEquals("1", low.getCode().getCodeValue());
    assertEquals("id", low.getId());
    assertEquals(Double.valueOf(1), low.getValue());
    assertEquals("ms", low.getUnit());
    SimpleQuantity high = usageContext.getValue().getHigh();
    assertEquals("10", high.getCode().getCodeValue());
    assertEquals("id2", high.getId());
    assertEquals(Double.valueOf(10), high.getValue());
    assertEquals("ms", high.getUnit());
}
Also used : SimpleQuantity(com.b2international.snowowl.fhir.core.model.dt.SimpleQuantity)

Example 2 with SimpleQuantity

use of com.b2international.snowowl.fhir.core.model.dt.SimpleQuantity 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 3 with SimpleQuantity

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

the class RangeTest method setup.

@Before
public void setup() throws Exception {
    SimpleQuantity low = SimpleQuantity.builder().value(12.3).unit("mg").system("uri:LOINC").code("code1").build();
    SimpleQuantity high = (SimpleQuantity) SimpleQuantity.builder().value(120.3).unit("mg").system("uri:LOINC").code("code2").build();
    range = Range.builder().low(low).high(high).id("id").build();
}
Also used : SimpleQuantity(com.b2international.snowowl.fhir.core.model.dt.SimpleQuantity) Before(org.junit.Before)

Example 4 with SimpleQuantity

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

the class SimpleQuantityTest method deserialize.

@Test
public void deserialize() throws Exception {
    SimpleQuantity readQuantity = objectMapper.readValue(objectMapper.writeValueAsString(quantity), SimpleQuantity.class);
    assertEquals(Double.valueOf(12.3), readQuantity.getValue());
    assertEquals("mg", readQuantity.getUnit());
    assertEquals(new Uri("uri:LOINC"), readQuantity.getSystem());
    assertEquals(new Code("code"), readQuantity.getCode());
}
Also used : SimpleQuantity(com.b2international.snowowl.fhir.core.model.dt.SimpleQuantity) 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 5 with SimpleQuantity

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

the class RangeTest method build.

@Test
public void build() throws Exception {
    assertEquals("id", range.getId());
    SimpleQuantity low = range.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) Code(com.b2international.snowowl.fhir.core.model.dt.Code) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Aggregations

SimpleQuantity (com.b2international.snowowl.fhir.core.model.dt.SimpleQuantity)5 Code (com.b2international.snowowl.fhir.core.model.dt.Code)3 FhirTest (com.b2international.snowowl.fhir.tests.FhirTest)3 Test (org.junit.Test)3 OperationOutcomeCode (com.b2international.snowowl.fhir.core.codesystems.OperationOutcomeCode)1 Range (com.b2international.snowowl.fhir.core.model.dt.Range)1 Uri (com.b2international.snowowl.fhir.core.model.dt.Uri)1 Before (org.junit.Before)1