Skip to content
This repository was archived by the owner on Oct 6, 2025. It is now read-only.

Commit 6aa716b

Browse files
committed
UCUM learning test
1 parent 0dfbf2a commit 6aa716b

2 files changed

Lines changed: 2094 additions & 0 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
package de.netzwerk_universitaetsmedizin.codex.processes.data_transfer.validation;
2+
3+
import static org.junit.Assert.assertEquals;
4+
import static org.junit.Assert.assertNull;
5+
import static org.junit.Assert.assertTrue;
6+
7+
import java.io.InputStream;
8+
import java.nio.file.Files;
9+
import java.nio.file.Paths;
10+
11+
import org.fhir.ucum.UcumEssenceService;
12+
import org.junit.Test;
13+
14+
public class UcumLearningTest
15+
{
16+
@Test
17+
public void test() throws Exception
18+
{
19+
String theCode = "{beats}/min";
20+
try (InputStream input = Files.newInputStream(Paths.get("src/test/resources/fhir/ucum/ucum-essence.xml")))
21+
{
22+
UcumEssenceService svc = new UcumEssenceService(input);
23+
assertEquals("1 / (minute)", svc.analyse(theCode));
24+
assertEquals("s-1", svc.getCanonicalUnits(theCode));
25+
assertTrue(svc.getDefinedForms(theCode).isEmpty());
26+
assertNull(svc.validate(theCode));
27+
assertEquals("{beats}/min", svc.getCommonDisplay(theCode));
28+
assertTrue(svc.isComparable(theCode, "/min"));
29+
}
30+
}
31+
32+
@Test
33+
public void test1() throws Exception
34+
{
35+
String theCode = "/min";
36+
try (InputStream input = Files.newInputStream(Paths.get("src/test/resources/fhir/ucum/ucum-essence.xml")))
37+
{
38+
UcumEssenceService svc = new UcumEssenceService(input);
39+
assertEquals(" / (minute)", svc.analyse(theCode));
40+
assertEquals("s-1", svc.getCanonicalUnits(theCode));
41+
assertTrue(svc.getDefinedForms(theCode).isEmpty());
42+
assertNull(svc.validate(theCode));
43+
assertEquals("/min", svc.getCommonDisplay(theCode));
44+
assertTrue(svc.isComparable(theCode, "/min"));
45+
}
46+
}
47+
}

0 commit comments

Comments
 (0)