Search in sources :

Example 1 with Extension

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

the class ExtensionTest method buildWithStringSubextension.

@Test
public void buildWithStringSubextension() throws Exception {
    Extension extension = StringExtension.builder().url("topURL").addExtension(StringExtension.builder().url("subURL").value("stringValue").build()).build();
    printPrettyJson(extension);
    assertEquals(new Uri("topURL"), extension.getUrl());
    assertEquals(ExtensionType.STRING, extension.getExtensionType());
    Extension subExtension = extension.getExtensions().iterator().next();
    assertEquals(new Uri("subURL"), subExtension.getUrl());
    assertEquals("stringValue", subExtension.getValue());
}
Also used : StringExtension(com.b2international.snowowl.fhir.core.model.StringExtension) Extension(com.b2international.snowowl.fhir.core.model.Extension) IntegerExtension(com.b2international.snowowl.fhir.core.model.IntegerExtension) Uri(com.b2international.snowowl.fhir.core.model.dt.Uri) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Example 2 with Extension

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

the class ExtensionTest method buildWithSubextension.

@Test
public void buildWithSubextension() throws Exception {
    Extension<Integer> extension = IntegerExtension.builder().url("ID").addExtension(IntegerExtension.builder().url("ID2").value(2).build()).build();
    printPrettyJson(extension);
    assertEquals(new Uri("ID"), extension.getUrl());
    assertEquals(ExtensionType.INTEGER, extension.getExtensionType());
    Extension subExtension = extension.getExtensions().iterator().next();
    assertEquals(new Uri("ID2"), subExtension.getUrl());
    assertEquals(Integer.valueOf(2), subExtension.getValue());
}
Also used : StringExtension(com.b2international.snowowl.fhir.core.model.StringExtension) Extension(com.b2international.snowowl.fhir.core.model.Extension) IntegerExtension(com.b2international.snowowl.fhir.core.model.IntegerExtension) Uri(com.b2international.snowowl.fhir.core.model.dt.Uri) FhirTest(com.b2international.snowowl.fhir.tests.FhirTest) Test(org.junit.Test)

Aggregations

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 Uri (com.b2international.snowowl.fhir.core.model.dt.Uri)2 FhirTest (com.b2international.snowowl.fhir.tests.FhirTest)2 Test (org.junit.Test)2