Search in sources :

Example 16 with Uri

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

the class QuantityTest 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());
    assertEquals(QuantityComparator.GREATER_OR_EQUAL_TO.getCode(), quantity.getComparator());
}
Also used : Uri(com.b2international.snowowl.fhir.core.model.dt.Uri) Code(com.b2international.snowowl.fhir.core.model.dt.Code) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 17 with Uri

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

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

the class ExpandValueSetRequestDeserializationTest method deserializationTest.

@Test
public void deserializationTest() throws Exception {
    ExpandValueSetRequest request = ExpandValueSetRequest.builder().url("http://valueset.url").valueSetVersion("20190101").contextDirection("direction-code").count(1).addDesignation("uk_en").addDesignation("us_en").date(TEST_DATE_STRING).filter("filter").build();
    Json json = new Parameters.Json(request);
    // System.out.println("JSON params:" + json);
    Fhir fhirParameters = new Parameters.Fhir(request);
    // fhirParameters.getParameters().forEach(p -> System.out.println(p));
    Optional<Parameter> findFirst = fhirParameters.getParameters().stream().filter(p -> {
        Uri url = (Uri) p.getValue();
        return url.getUriValue().equals("http://valueset.url");
    }).findFirst();
    assertTrue(findFirst.isPresent());
// Fhir fhir = new Parameters.Fhir(json.parameters());
// printPrettyJson(fhir);
// String fhirJson = objectMapper.writeValueAsString(fhir);
// System.out.println("This is the JSON request from the client: " + fhirJson);
}
Also used : OperationOutcomeCode(com.b2international.snowowl.fhir.core.codesystems.OperationOutcomeCode) ValidationException(com.b2international.snowowl.fhir.core.exceptions.ValidationException) IssueSeverity(com.b2international.snowowl.fhir.core.codesystems.IssueSeverity) Parameter(com.b2international.snowowl.fhir.core.model.dt.Parameter) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Assert.assertTrue(org.junit.Assert.assertTrue) Fhir(com.b2international.snowowl.fhir.core.model.dt.Parameters.Fhir) Test(org.junit.Test) Uri(com.b2international.snowowl.fhir.core.model.dt.Uri) LookupRequest(com.b2international.snowowl.fhir.core.model.codesystem.LookupRequest) IssueType(com.b2international.snowowl.fhir.core.codesystems.IssueType) Json(com.b2international.snowowl.fhir.core.model.dt.Parameters.Json) ExpandValueSetRequest(com.b2international.snowowl.fhir.core.model.valueset.ExpandValueSetRequest) Issue(com.b2international.snowowl.fhir.core.model.Issue) Optional(java.util.Optional) Builder(com.b2international.snowowl.fhir.core.model.Issue.Builder) Parameters(com.b2international.snowowl.fhir.core.model.dt.Parameters) Coding(com.b2international.snowowl.fhir.core.model.dt.Coding) FhirExceptionIssueMatcher(com.b2international.snowowl.fhir.tests.FhirExceptionIssueMatcher) ExpandValueSetRequest(com.b2international.snowowl.fhir.core.model.valueset.ExpandValueSetRequest) Parameter(com.b2international.snowowl.fhir.core.model.dt.Parameter) Fhir(com.b2international.snowowl.fhir.core.model.dt.Parameters.Fhir) Json(com.b2international.snowowl.fhir.core.model.dt.Parameters.Json) Uri(com.b2international.snowowl.fhir.core.model.dt.Uri) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 19 with Uri

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

the class ValueSetConceptTest method validate.

private void validate(ValueSetConcept concept) {
    assertEquals(new Code("code"), concept.getCode());
    assertEquals("display", concept.getDisplay());
    Designation designation = concept.getDesignations().iterator().next();
    assertEquals("gb_en", designation.getLanguage());
    assertEquals("designationValue", designation.getValue());
    assertEquals(new Code("internal"), designation.getUse().getCode());
    assertEquals(new Uri("http://b2i.sg/test"), designation.getUse().getSystem());
}
Also used : Designation(com.b2international.snowowl.fhir.core.model.Designation) Code(com.b2international.snowowl.fhir.core.model.dt.Code) Uri(com.b2international.snowowl.fhir.core.model.dt.Uri)

Example 20 with Uri

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

the class ContactPointTest method build.

@Test
public void build() {
    assertEquals("element_id", contactPoint.getId());
    assertEquals(Integer.valueOf(1), contactPoint.getRank());
    assertEquals(new Code("system"), contactPoint.getSystem());
    assertEquals(new Code("use"), contactPoint.getUse());
    assertEquals("value", contactPoint.getValue());
    assertEquals(new Uri("url"), contactPoint.getExtensions().iterator().next().getUrl());
}
Also used : 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)

Aggregations

Uri (com.b2international.snowowl.fhir.core.model.dt.Uri)21 FhirTest (com.b2international.snowowl.fhir.tests.FhirTest)15 Test (org.junit.Test)15 Code (com.b2international.snowowl.fhir.core.model.dt.Code)10 OperationOutcomeCode (com.b2international.snowowl.fhir.core.codesystems.OperationOutcomeCode)4 JsonPath (io.restassured.path.json.JsonPath)3 Designation (com.b2international.snowowl.fhir.core.model.Designation)2 Extension (com.b2international.snowowl.fhir.core.model.Extension)2 IntegerExtension (com.b2international.snowowl.fhir.core.model.IntegerExtension)2 StringExtension (com.b2international.snowowl.fhir.core.model.StringExtension)2 CodeSystem (com.b2international.snowowl.fhir.core.model.codesystem.CodeSystem)2 Coding (com.b2international.snowowl.fhir.core.model.dt.Coding)2 SnowOwlConfiguration (com.b2international.snowowl.core.config.SnowOwlConfiguration)1 SnowOwlOpenApiWebMvcResource (com.b2international.snowowl.core.rest.SnowOwlOpenApiWebMvcResource)1 IssueSeverity (com.b2international.snowowl.fhir.core.codesystems.IssueSeverity)1 IssueType (com.b2international.snowowl.fhir.core.codesystems.IssueType)1 BadRequestException (com.b2international.snowowl.fhir.core.exceptions.BadRequestException)1 ValidationException (com.b2international.snowowl.fhir.core.exceptions.ValidationException)1 Bundle (com.b2international.snowowl.fhir.core.model.Bundle)1 Issue (com.b2international.snowowl.fhir.core.model.Issue)1