use of com.nedap.archie.rm.datavalues.quantity.DvCount in project openEHR_SDK by ehrbase.
the class DvCountValidatorTest method testValidate.
@Test
void testValidate() throws Exception {
var node = parseNode("/webtemplate_nodes/dv_count.json");
var result = validator.validate(new DvCount(10L), node);
assertTrue(result.isEmpty());
}
use of com.nedap.archie.rm.datavalues.quantity.DvCount in project openEHR_SDK by ehrbase.
the class StatusesTestOverwrite method count.
@Override
@Test
public void count() throws Exception {
String template = this.getFileContent("/res/test_statuses.opt");
Map<String, Object> flatComposition = Map.of("ctx/language", "sl", "ctx/territory", "SI", "ctx/composer_name", "George Orwell", "test_statuses/test_statuses:0/count", 1, "test_statuses/test_statuses:0/count|normal_status", "L", "test_statuses/test_statuses:0/count|magnitude_status", ">=", "test_statuses/test_statuses:0/count|accuracy", 10.0, "test_statuses/test_statuses:0/count|accuracy_is_percent", true);
RMDataFormat flatJson = getFlatJson(template, FlatFormat.SIM_SDT);
Composition composition = flatJson.unmarshal(OBJECT_MAPPER.writeValueAsString(flatComposition));
DvCount rmObject = (DvCount) composition.itemAtPath("/content[openEHR-EHR-OBSERVATION.test_statuses.v0]/data[at0001]/events[at0002]/data[at0003]/items[at0014]/value");
assertThat(rmObject.getNormalStatus()).isNotNull();
assertThat(rmObject.getNormalStatus().getTerminologyId().getValue()).isEqualTo("openehr_normal_statuses");
assertThat(rmObject.getNormalStatus().getCodeString()).isEqualTo("L");
assertThat(rmObject.getMagnitudeStatus()).isEqualTo(">=");
assertThat(rmObject.getAccuracy()).isEqualTo(10);
assertThat(rmObject.getAccuracyIsPercent()).isTrue();
Map<String, Object> value = OBJECT_MAPPER.readValue(flatJson.marshal(composition), Map.class);
assertThat(value).containsEntry("test_statuses/test_statuses:0/count|normal_status", "L").containsEntry("test_statuses/test_statuses:0/count|magnitude_status", ">=").containsEntry("test_statuses/test_statuses:0/count|accuracy", 10.0).containsEntry("test_statuses/test_statuses:0/count|accuracy_is_percent", true);
}
use of com.nedap.archie.rm.datavalues.quantity.DvCount in project openEHR_SDK by ehrbase.
the class DvCountValidatorTest method testValidate_Range_Unbounded.
@Test
void testValidate_Range_Unbounded() throws Exception {
var node = parseNode("/webtemplate_nodes/dv_count_range_unbounded.json");
var result = validator.validate(new DvCount(0L), node);
assertTrue(result.isEmpty());
result = validator.validate(new DvCount(10L), node);
assertTrue(result.isEmpty());
result = validator.validate(new DvCount(10000L), node);
assertTrue(result.isEmpty());
result = validator.validate(new DvCount(-1L), node);
assertEquals(1, result.size());
}
use of com.nedap.archie.rm.datavalues.quantity.DvCount in project openEHR_SDK by ehrbase.
the class DvCountValidatorTest method testValidate_Range.
@Test
void testValidate_Range() throws Exception {
var node = parseNode("/webtemplate_nodes/dv_count_range.json");
var result = validator.validate(new DvCount(10L), node);
assertTrue(result.isEmpty());
result = validator.validate(new DvCount(1L), node);
assertTrue(result.isEmpty());
result = validator.validate(new DvCount(0L), node);
assertEquals(1, result.size());
result = validator.validate(new DvCount(20L), node);
assertEquals(1, result.size());
result = validator.validate(new DvCount(100L), node);
assertEquals(1, result.size());
}
Aggregations