use of com.b2international.snowowl.fhir.core.model.dt.Instant in project snow-owl by b2ihealthcare.
the class MetaTest method setup.
@Before
public void setup() throws Exception {
DateFormat df = new SimpleDateFormat(FhirDates.DATE_TIME_FORMAT);
Date date = df.parse(TEST_DATE_STRING);
Instant instant = Instant.builder().instant(date).build();
meta = Meta.builder().id("ID").lastUpdated(instant).versionId("VersionID").addExtension(IntegerExtension.builder().url("ExtensionId").value(1).build()).addProfile("profile").addSecurity(securityCoding).addTag(tagCoding).build();
}
use of com.b2international.snowowl.fhir.core.model.dt.Instant in project snow-owl by b2ihealthcare.
the class TypedPropertySerializationTest method instantTypedPropertyTest.
@Test
public void instantTypedPropertyTest() throws Exception {
Date date = Dates.parse(TEST_DATE_STRING, FhirDates.DATE_TIME_FORMAT);
Instant instant = Instant.builder().instant(date).build();
final class TestClass {
@JsonUnwrapped
@JsonProperty
private TypedProperty<?> value = new InstantProperty(instant);
}
TestClass testObject = new TestClass();
printPrettyJson(testObject);
JsonPath jsonPath = JsonPath.from(objectMapper.writeValueAsString(testObject));
assertThat(jsonPath.getString("valueInstant"), equalTo("2018-03-23T07:49:40Z"));
}
use of com.b2international.snowowl.fhir.core.model.dt.Instant in project snow-owl by b2ihealthcare.
the class InstantTest method deserialize.
@Test
public void deserialize() throws JsonProcessingException {
String time = "2021-06-25T19:33:14.520121Z";
Instant instant = Instant.builder().instant(time).build();
String serializedString = objectMapper.writeValueAsString(instant);
Instant readInstant = objectMapper.readValue(serializedString, Instant.class);
System.out.println("Expected: " + time + " actual: " + readInstant.getInstant());
assertEquals(time, readInstant.getInstant());
}
use of com.b2international.snowowl.fhir.core.model.dt.Instant in project snow-owl by b2ihealthcare.
the class InstantTest method serialize.
@Test
public void serialize() throws JsonProcessingException {
String time = "2021-06-25T19:33:14.520121Z";
Instant instant = Instant.builder().instant(time).build();
String serializedString = objectMapper.writeValueAsString(instant);
assertEquals("\"" + time + "\"", serializedString);
}
use of com.b2international.snowowl.fhir.core.model.dt.Instant in project snow-owl by b2ihealthcare.
the class InstantTest method buildFromDate.
@Test
public void buildFromDate() throws Exception {
Date date = Dates.parse(TEST_DATE_STRING, FhirDates.DATE_TIME_FORMAT);
Instant instant = Instant.builder().instant(date).build();
assertEquals("\"2018-03-23T07:49:40Z\"", objectMapper.writeValueAsString(instant));
}
Aggregations