diff --git a/org.hl7.fhir.convertors/pom.xml b/org.hl7.fhir.convertors/pom.xml index d61cc8b27..31b26d183 100644 --- a/org.hl7.fhir.convertors/pom.xml +++ b/org.hl7.fhir.convertors/pom.xml @@ -66,6 +66,19 @@ true + + + org.junit.jupiter + junit-jupiter-api + ${junit_jupiter_version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit_jupiter_version} + test + diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_50Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_50Test.java index bb913ad40..cf756616a 100644 --- a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_50Test.java +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType10_50Test.java @@ -1,6 +1,22 @@ package org.hl7.fhir.convertors; -import org.hl7.fhir.dstu2.model.*; +import org.hl7.fhir.dstu2.model.Base64BinaryType; +import org.hl7.fhir.dstu2.model.BooleanType; +import org.hl7.fhir.dstu2.model.CodeType; +import org.hl7.fhir.dstu2.model.DateTimeType; +import org.hl7.fhir.dstu2.model.DateType; +import org.hl7.fhir.dstu2.model.DecimalType; +import org.hl7.fhir.dstu2.model.InstantType; +import org.hl7.fhir.dstu2.model.IntegerType; +import org.hl7.fhir.dstu2.model.MarkdownType; +import org.hl7.fhir.dstu2.model.OidType; +import org.hl7.fhir.dstu2.model.PositiveIntType; +import org.hl7.fhir.dstu2.model.PrimitiveType; +import org.hl7.fhir.dstu2.model.StringType; +import org.hl7.fhir.dstu2.model.TimeType; +import org.hl7.fhir.dstu2.model.UnsignedIntType; +import org.hl7.fhir.dstu2.model.UriType; +import org.hl7.fhir.dstu2.model.UuidType; import org.hl7.fhir.exceptions.FHIRFormatError; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -8,10 +24,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import junit.framework.Assert; - import java.io.IOException; -import java.io.InputStream; import java.util.stream.Stream; public class VersionConvertorPrimitiveType10_50Test { @@ -22,10 +35,10 @@ public class VersionConvertorPrimitiveType10_50Test { public void testAuditEvent() throws FHIRFormatError, IOException { org.hl7.fhir.dstu2.model.AuditEvent ae2 = (org.hl7.fhir.dstu2.model.AuditEvent) new org.hl7.fhir.dstu2.formats.JsonParser().parse(AUDIT_EVENT_SOURCE); org.hl7.fhir.r5.model.AuditEvent ae5 = (org.hl7.fhir.r5.model.AuditEvent) VersionConvertor_10_50.convertResource(ae2); - Assert.assertEquals(ae5.getId(), ae2.getId()); + Assertions.assertEquals(ae5.getId(), ae2.getId()); } - - + + @ParameterizedTest(name = "Testing dstu2 -> r5 conversion of null value {0}.") @MethodSource("dstu2PrimitiveTypes") public void testNullValueDstu2Primitive(String classname, T obj) { diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType30_40Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType30_40Test.java index 58bb89d35..fa24d5176 100644 --- a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType30_40Test.java +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType30_40Test.java @@ -1,6 +1,22 @@ package org.hl7.fhir.convertors; -import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.dstu3.model.Base64BinaryType; +import org.hl7.fhir.dstu3.model.BooleanType; +import org.hl7.fhir.dstu3.model.CodeType; +import org.hl7.fhir.dstu3.model.DateTimeType; +import org.hl7.fhir.dstu3.model.DateType; +import org.hl7.fhir.dstu3.model.DecimalType; +import org.hl7.fhir.dstu3.model.InstantType; +import org.hl7.fhir.dstu3.model.IntegerType; +import org.hl7.fhir.dstu3.model.MarkdownType; +import org.hl7.fhir.dstu3.model.OidType; +import org.hl7.fhir.dstu3.model.PositiveIntType; +import org.hl7.fhir.dstu3.model.PrimitiveType; +import org.hl7.fhir.dstu3.model.StringType; +import org.hl7.fhir.dstu3.model.TimeType; +import org.hl7.fhir.dstu3.model.UnsignedIntType; +import org.hl7.fhir.dstu3.model.UriType; +import org.hl7.fhir.dstu3.model.UuidType; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType30_50Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType30_50Test.java index 576574d6a..d93e3d641 100644 --- a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType30_50Test.java +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType30_50Test.java @@ -1,6 +1,22 @@ package org.hl7.fhir.convertors; -import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.dstu3.model.Base64BinaryType; +import org.hl7.fhir.dstu3.model.BooleanType; +import org.hl7.fhir.dstu3.model.CodeType; +import org.hl7.fhir.dstu3.model.DateTimeType; +import org.hl7.fhir.dstu3.model.DateType; +import org.hl7.fhir.dstu3.model.DecimalType; +import org.hl7.fhir.dstu3.model.InstantType; +import org.hl7.fhir.dstu3.model.IntegerType; +import org.hl7.fhir.dstu3.model.MarkdownType; +import org.hl7.fhir.dstu3.model.OidType; +import org.hl7.fhir.dstu3.model.PositiveIntType; +import org.hl7.fhir.dstu3.model.PrimitiveType; +import org.hl7.fhir.dstu3.model.StringType; +import org.hl7.fhir.dstu3.model.TimeType; +import org.hl7.fhir.dstu3.model.UnsignedIntType; +import org.hl7.fhir.dstu3.model.UriType; +import org.hl7.fhir.dstu3.model.UuidType; import org.hl7.fhir.exceptions.FHIRFormatError; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -8,10 +24,7 @@ import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import junit.framework.Assert; - import java.io.IOException; -import java.io.InputStream; import java.util.stream.Stream; public class VersionConvertorPrimitiveType30_50Test { @@ -22,9 +35,9 @@ public class VersionConvertorPrimitiveType30_50Test { public void testAuditEvent() throws FHIRFormatError, IOException { org.hl7.fhir.dstu3.model.AuditEvent ae3 = (org.hl7.fhir.dstu3.model.AuditEvent) new org.hl7.fhir.dstu3.formats.JsonParser().parse(AUDIT_EVENT_SOURCE); org.hl7.fhir.r5.model.AuditEvent ae5 = (org.hl7.fhir.r5.model.AuditEvent) VersionConvertor_30_50.convertResource(ae3, false); - Assert.assertEquals(ae5.getId(), ae3.getId()); + Assertions.assertEquals(ae5.getId(), ae3.getId()); } - + @ParameterizedTest(name = "Testing dstu3 -> r5 conversion of null value {0}.") @MethodSource("dstu3PrimitiveTypes") public void testNullValueDstu2Primitive(String classname, T obj) { diff --git a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType40_50Test.java b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType40_50Test.java index 5e661c75d..98a80c086 100644 --- a/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType40_50Test.java +++ b/org.hl7.fhir.convertors/src/test/java/org/hl7/fhir/convertors/VersionConvertorPrimitiveType40_50Test.java @@ -1,17 +1,30 @@ package org.hl7.fhir.convertors; import org.hl7.fhir.exceptions.FHIRFormatError; -import org.hl7.fhir.r4.model.*; +import org.hl7.fhir.r4.model.Base64BinaryType; +import org.hl7.fhir.r4.model.BooleanType; +import org.hl7.fhir.r4.model.CodeType; +import org.hl7.fhir.r4.model.DateTimeType; +import org.hl7.fhir.r4.model.DateType; +import org.hl7.fhir.r4.model.DecimalType; +import org.hl7.fhir.r4.model.InstantType; +import org.hl7.fhir.r4.model.IntegerType; +import org.hl7.fhir.r4.model.MarkdownType; +import org.hl7.fhir.r4.model.OidType; +import org.hl7.fhir.r4.model.PositiveIntType; +import org.hl7.fhir.r4.model.PrimitiveType; +import org.hl7.fhir.r4.model.StringType; +import org.hl7.fhir.r4.model.TimeType; +import org.hl7.fhir.r4.model.UnsignedIntType; +import org.hl7.fhir.r4.model.UriType; +import org.hl7.fhir.r4.model.UuidType; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import junit.framework.Assert; - import java.io.IOException; -import java.io.InputStream; import java.util.stream.Stream; public class VersionConvertorPrimitiveType40_50Test { @@ -22,10 +35,10 @@ public class VersionConvertorPrimitiveType40_50Test { public void testAuditEvent() throws FHIRFormatError, IOException { org.hl7.fhir.r4.model.AuditEvent ae4 = (org.hl7.fhir.r4.model.AuditEvent) new org.hl7.fhir.r4.formats.JsonParser().parse(AUDIT_EVENT_SOURCE); org.hl7.fhir.r5.model.AuditEvent ae5 = (org.hl7.fhir.r5.model.AuditEvent) VersionConvertor_40_50.convertResource(ae4); - Assert.assertEquals(ae5.getId(), ae4.getId()); + Assertions.assertEquals(ae5.getId(), ae4.getId()); } - - + + @ParameterizedTest(name = "Testing r4 -> r5 conversion of null value {0}.") @MethodSource("r4PrimitiveTypes") public void testNullValueDstu2Primitive(String classname, T obj) { diff --git a/org.hl7.fhir.dstu2/pom.xml b/org.hl7.fhir.dstu2/pom.xml index 58ce94f6c..d49269459 100644 --- a/org.hl7.fhir.dstu2/pom.xml +++ b/org.hl7.fhir.dstu2/pom.xml @@ -95,6 +95,20 @@ Saxon-HE test + + + + org.junit.jupiter + junit-jupiter-api + ${junit_jupiter_version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit_jupiter_version} + test + diff --git a/org.hl7.fhir.dstu2/src/test/java/org/hl7/fhir/dstu2/test/MetaTest.java b/org.hl7.fhir.dstu2/src/test/java/org/hl7/fhir/dstu2/test/MetaTest.java index 6ded2d99c..75f0e391c 100644 --- a/org.hl7.fhir.dstu2/src/test/java/org/hl7/fhir/dstu2/test/MetaTest.java +++ b/org.hl7.fhir.dstu2/src/test/java/org/hl7/fhir/dstu2/test/MetaTest.java @@ -2,9 +2,8 @@ package org.hl7.fhir.dstu2.test; import org.hl7.fhir.dstu2.model.Coding; import org.hl7.fhir.dstu2.model.Meta; -import org.junit.Test; - -import static org.junit.Assert.*; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; public class MetaTest { public static String TEST_SYSTEM = "TEST_SYSTEM"; @@ -14,11 +13,11 @@ public class MetaTest { public void testMetaSecurity() { Meta meta = new Meta(); Coding coding = meta.addSecurity().setSystem(TEST_SYSTEM).setCode(TEST_CODE); - assertTrue(meta.hasSecurity()); - assertNotNull(meta.getSecurity()); - assertNotNull(meta.getSecurity(TEST_SYSTEM, TEST_CODE)); - assertEquals(1, meta.getSecurity().size()); - assertEquals(meta.getSecurity().get(0), meta.getSecurity(TEST_SYSTEM, TEST_CODE)); - assertEquals(coding, meta.getSecurity(TEST_SYSTEM, TEST_CODE)); + Assertions.assertTrue(meta.hasSecurity()); + Assertions.assertNotNull(meta.getSecurity()); + Assertions.assertNotNull(meta.getSecurity(TEST_SYSTEM, TEST_CODE)); + Assertions.assertEquals(1, meta.getSecurity().size()); + Assertions.assertEquals(meta.getSecurity().get(0), meta.getSecurity(TEST_SYSTEM, TEST_CODE)); + Assertions.assertEquals(coding, meta.getSecurity(TEST_SYSTEM, TEST_CODE)); } } diff --git a/org.hl7.fhir.dstu2016may/pom.xml b/org.hl7.fhir.dstu2016may/pom.xml index a4cd6c59b..c4c1378fe 100644 --- a/org.hl7.fhir.dstu2016may/pom.xml +++ b/org.hl7.fhir.dstu2016may/pom.xml @@ -109,6 +109,20 @@ Saxon-HE test + + + + org.junit.jupiter + junit-jupiter-api + ${junit_jupiter_version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit_jupiter_version} + test + diff --git a/org.hl7.fhir.dstu2016may/src/test/java/org/hl7/fhir/dstu2016may/test/BaseDateTimeTypeTest.java b/org.hl7.fhir.dstu2016may/src/test/java/org/hl7/fhir/dstu2016may/test/BaseDateTimeTypeTest.java index 9a6670ca9..ecc92c6e5 100644 --- a/org.hl7.fhir.dstu2016may/src/test/java/org/hl7/fhir/dstu2016may/test/BaseDateTimeTypeTest.java +++ b/org.hl7.fhir.dstu2016may/src/test/java/org/hl7/fhir/dstu2016may/test/BaseDateTimeTypeTest.java @@ -3,8 +3,8 @@ package org.hl7.fhir.dstu2016may.test; import ca.uhn.fhir.model.api.TemporalPrecisionEnum; import org.hl7.fhir.dstu2016may.model.DateType; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; import java.text.SimpleDateFormat; import java.util.Calendar; @@ -16,7 +16,7 @@ import static org.junit.Assert.assertEquals; public class BaseDateTimeTypeTest { private SimpleDateFormat myDateInstantParser; - @Before + @BeforeEach public void before() { myDateInstantParser = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); } @@ -52,6 +52,4 @@ public class BaseDateTimeTypeTest { date.setValue(time); assertEquals("2012-01-02", date.getValueAsString()); } - - } diff --git a/org.hl7.fhir.dstu2016may/src/test/java/org/hl7/fhir/dstu2016may/test/FluentPathTests.java b/org.hl7.fhir.dstu2016may/src/test/java/org/hl7/fhir/dstu2016may/test/FluentPathTests.java index 536069aca..093951fc3 100644 --- a/org.hl7.fhir.dstu2016may/src/test/java/org/hl7/fhir/dstu2016may/test/FluentPathTests.java +++ b/org.hl7.fhir.dstu2016may/src/test/java/org/hl7/fhir/dstu2016may/test/FluentPathTests.java @@ -1,10 +1,5 @@ package org.hl7.fhir.dstu2016may.test; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.List; - import org.hl7.fhir.dstu2016may.formats.JsonParser; import org.hl7.fhir.dstu2016may.model.Appointment; import org.hl7.fhir.dstu2016may.model.Base; @@ -30,11 +25,15 @@ import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRFormatError; import org.hl7.fhir.exceptions.PathEngineException; import org.hl7.fhir.utilities.CommaSeparatedStringBuilder; - -import junit.framework.Assert; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.util.List; + @Disabled public class FluentPathTests { @@ -77,7 +76,7 @@ public class FluentPathTests { @SuppressWarnings("deprecation") private void test(Resource resource, String expression, int count, String... types) throws FileNotFoundException, IOException, FHIRException { if (TestingUtilities.context == null) - TestingUtilities.context = SimpleWorkerContext.fromPack("C:\\work\\org.hl7.fhir\\build\\publish\\validation-min.xml.zip"); + TestingUtilities.context = SimpleWorkerContext.fromPack("C:\\work\\org.hl7.fhir\\build\\publish\\validation-min.xml.zip"); FHIRPathEngine fp = new FHIRPathEngine(TestingUtilities.context); ExpressionNode node = fp.parse(expression); @@ -86,7 +85,7 @@ public class FluentPathTests { if (fp.hasLog()) System.out.println(fp.takeLog()); - Assert.assertTrue(String.format("Expected %d objects but found %d", count, outcome.size()), outcome.size() == count); + Assertions.assertTrue(outcome.size() == count, String.format("Expected %d objects but found %d", count, outcome.size())); CommaSeparatedStringBuilder msg = new CommaSeparatedStringBuilder(); for (String t : types) msg.append(t); @@ -94,16 +93,16 @@ public class FluentPathTests { boolean found = false; String type = b.fhirType(); for (String t : types) - if (type.equals(t)) + if (type.equals(t)) found = true; - Assert.assertTrue(String.format("Object type %s not ok from %s", type, msg), found); + Assertions.assertTrue(found, String.format("Object type %s not ok from %s", type, msg)); } } @SuppressWarnings("deprecation") private void testBoolean(Resource resource, String expression, boolean value) throws FileNotFoundException, IOException, FHIRException { if (TestingUtilities.context == null) - TestingUtilities.context = SimpleWorkerContext.fromPack("C:\\work\\org.hl7.fhir\\build\\publish\\validation-min.xml.zip"); + TestingUtilities.context = SimpleWorkerContext.fromPack("C:\\work\\org.hl7.fhir\\build\\publish\\validation-min.xml.zip"); FHIRPathEngine fp = new FHIRPathEngine(TestingUtilities.context); ExpressionNode node = fp.parse(expression); @@ -112,13 +111,13 @@ public class FluentPathTests { if (fp.hasLog()) System.out.println(fp.takeLog()); - Assert.assertTrue("Wrong answer", fp.convertToBoolean(outcome) == value); + Assertions.assertEquals(fp.convertToBoolean(outcome), value, "Wrong answer"); } @SuppressWarnings("deprecation") private void testBoolean(Resource resource, Base focus, String focusType, String expression, boolean value) throws FileNotFoundException, IOException, FHIRException { if (TestingUtilities.context == null) - TestingUtilities.context = SimpleWorkerContext.fromPack("C:\\work\\org.hl7.fhir\\build\\publish\\validation-min.xml.zip"); + TestingUtilities.context = SimpleWorkerContext.fromPack("C:\\work\\org.hl7.fhir\\build\\publish\\validation-min.xml.zip"); FHIRPathEngine fp = new FHIRPathEngine(TestingUtilities.context); ExpressionNode node = fp.parse(expression); @@ -127,12 +126,12 @@ public class FluentPathTests { if (fp.hasLog()) System.out.println(fp.takeLog()); - Assert.assertTrue("Wrong answer", fp.convertToBoolean(outcome) == value); + Assertions.assertEquals(fp.convertToBoolean(outcome), value, "Wrong answer"); } private void testWrong(Resource resource, String expression) throws FileNotFoundException, IOException, FHIRException { if (TestingUtilities.context == null) - TestingUtilities.context = SimpleWorkerContext.fromPack("C:\\work\\org.hl7.fhir\\build\\publish\\validation-min.xml.zip"); + TestingUtilities.context = SimpleWorkerContext.fromPack("C:\\work\\org.hl7.fhir\\build\\publish\\validation-min.xml.zip"); FHIRPathEngine fp = new FHIRPathEngine(TestingUtilities.context); try { @@ -141,7 +140,7 @@ public class FluentPathTests { fp.evaluate(null, null, resource, node); if (fp.hasLog()) System.out.println(fp.takeLog()); - Assert.assertTrue("Fail expected", false); + Assertions.fail("Fail expected"); } catch (PathEngineException e) { // ok } @@ -713,7 +712,7 @@ public class FluentPathTests { testBoolean(patient(), "(1 | 2 | 3).count() = 3", true); testBoolean(patient(), "(1 | 2 | 2).count() = 2", true); // merge duplicates } - + @Test public void testIn() throws FileNotFoundException, FHIRFormatError, IOException, FHIRException { testBoolean(patient(), "1 in (1 | 2 | 3)", true); @@ -735,7 +734,7 @@ public class FluentPathTests { testBoolean(patient(), "(true and true) = true", true); testBoolean(patient(), "(true and false) = false", true); testBoolean(patient(), "(true and {}) = {}", true); - + testBoolean(patient(), "(false and true) = false", true); testBoolean(patient(), "(false and false) = false", true); testBoolean(patient(), "(false and {}) = false", true); @@ -750,7 +749,7 @@ public class FluentPathTests { testBoolean(patient(), "(true or true) = true", true); testBoolean(patient(), "(true or false) = true", true); testBoolean(patient(), "(true or {}) = true", true); - + testBoolean(patient(), "(false or true) = true", true); testBoolean(patient(), "(false or false) = false", true); testBoolean(patient(), "(false or {}) = {}", true); @@ -765,7 +764,7 @@ public class FluentPathTests { testBoolean(patient(), "(true xor true) = false", true); testBoolean(patient(), "(true xor false) = true", true); testBoolean(patient(), "(true xor {}) = {}", true); - + testBoolean(patient(), "(false xor true) = true", true); testBoolean(patient(), "(false xor false) = false", true); testBoolean(patient(), "(false xor {}) = {}", true); @@ -774,13 +773,13 @@ public class FluentPathTests { testBoolean(patient(), "({} xor false) = {}", true); testBoolean(patient(), "({} xor {}) = {}", true); } - + @Test public void testBooleanImplies() throws FileNotFoundException, FHIRFormatError, IOException, FHIRException { testBoolean(patient(), "(true implies true) = true", true); testBoolean(patient(), "(true implies false) = false", true); testBoolean(patient(), "(true implies {}) = {}", true); - + testBoolean(patient(), "(false implies true) = true", true); testBoolean(patient(), "(false implies false) = true", true); testBoolean(patient(), "(false implies {}) = true", true); @@ -789,12 +788,12 @@ public class FluentPathTests { testBoolean(patient(), "({} implies false) = true", true); testBoolean(patient(), "({} implies {}) = true", true); } - + @Test public void testPlus() throws FileNotFoundException, FHIRFormatError, IOException, FHIRException { testBoolean(patient(), "1 + 1 = 2", true); testBoolean(patient(), "1 + 0 = 1", true); - testBoolean(patient(), "1.2 + 1.8 = 3.0", true); + testBoolean(patient(), "1.2 + 1.8 = 3.0", true); testBoolean(patient(), "'a'+'b' = 'ab'", true); } @@ -802,56 +801,56 @@ public class FluentPathTests { public void testConcatenate() throws FileNotFoundException, IOException, FHIRException { testBoolean(patient(), "1 & 1 = '11'", true); testBoolean(patient(), "1 & 'a' = '1a'", true); - testBoolean(patient(), "{} & 'b' = 'b'", true); - testBoolean(patient(), "(1 | 2 | 3) & 'b' = '1,2,3b'", true); + testBoolean(patient(), "{} & 'b' = 'b'", true); + testBoolean(patient(), "(1 | 2 | 3) & 'b' = '1,2,3b'", true); testBoolean(patient(), "'a'&'b' = 'ab'", true); } - + @Test public void testMinus() throws FileNotFoundException, FHIRFormatError, IOException, FHIRException { testBoolean(patient(), "1 - 1 = 0", true); testBoolean(patient(), "1 - 0 = 1", true); - testBoolean(patient(), "1.8 - 1.2 = 0.6", true); + testBoolean(patient(), "1.8 - 1.2 = 0.6", true); testWrong(patient(), "'a'-'b' = 'ab'"); } - + @Test public void testMultiply() throws FileNotFoundException, FHIRFormatError, IOException, FHIRException { testBoolean(patient(), "1 * 1 = 1", true); testBoolean(patient(), "1 * 0 = 0", true); - testBoolean(patient(), "1.2 * 1.8 = 2.16", true); + testBoolean(patient(), "1.2 * 1.8 = 2.16", true); } - + @Test public void testDivide() throws FileNotFoundException, FHIRFormatError, IOException, FHIRException { testBoolean(patient(), "1 / 1 = 1", true); testBoolean(patient(), "4 / 2 = 2", true); testBoolean(patient(), "1 / 2 = 0.5", true); - testBoolean(patient(), "1.2 / 1.8 = 0.67", true); + testBoolean(patient(), "1.2 / 1.8 = 0.67", true); } - + @Test public void testDiv() throws FileNotFoundException, FHIRFormatError, IOException, FHIRException { testBoolean(patient(), "1 div 1 = 1", true); testBoolean(patient(), "4 div 2 = 2", true); testBoolean(patient(), "5 div 2 = 2", true); - testBoolean(patient(), "2.2 div 1.8 = 1", true); + testBoolean(patient(), "2.2 div 1.8 = 1", true); } - + @Test public void testMod() throws FileNotFoundException, FHIRFormatError, IOException, FHIRException { testBoolean(patient(), "1 mod 1 = 0", true); testBoolean(patient(), "4 mod 2 = 0", true); testBoolean(patient(), "5 mod 2 = 1", true); - testBoolean(patient(), "2.2 mod 1.8 = 0.4", true); + testBoolean(patient(), "2.2 mod 1.8 = 0.4", true); } - + @Test public void testPrecedence() throws FileNotFoundException, FHIRFormatError, IOException, FHIRException { testBoolean(patient(), "1+2*3+4 = 11", true); } - + @Test public void testVariables() throws FileNotFoundException, FHIRFormatError, IOException, FHIRException { testBoolean(patient(), "%sct = 'http://snomed.info/sct'", true); @@ -859,28 +858,28 @@ public class FluentPathTests { testBoolean(patient(), "%ucum = 'http://unitsofmeasure.org'", true); testBoolean(patient(), "%\"vs-administrative-gender\" = 'http://hl7.org/fhir/ValueSet/administrative-gender'", true); } - + @Test public void testExtension() throws FileNotFoundException, FHIRFormatError, IOException, FHIRException { testBoolean(patient(), "Patient.birthDate.extension('http://hl7.org/fhir/StructureDefinition/patient-birthTime').exists()", true); testBoolean(patient(), "Patient.birthDate.extension(%\"ext-patient-birthTime\").exists()", true); testBoolean(patient(), "Patient.birthDate.extension('http://hl7.org/fhir/StructureDefinition/patient-birthTime1').empty()", true); } - + @Test public void testDollarResource() throws FileNotFoundException, FHIRFormatError, IOException, FHIRException { testBoolean(patient(), patient().getManagingOrganization(), "Reference", "reference.startsWith('#').not() or (reference.substring(1).trace('url') in %resource.contained.id.trace('ids'))", true); testBoolean(patient(), patient(), "Patient", "contained.select(('#'+id in %resource.descendents().reference).not()).empty()", true); testWrong(patient(), "contained.select(('#'+id in %resource.descendents().reference).not()).empty()"); } - + @Test public void testTyping() throws FileNotFoundException, IOException, FHIRException { ElementDefinition ed = new ElementDefinition(); ed.getBinding().setValueSet(new UriType("http://test.org")); testBoolean(null, ed.getBinding().getValueSet(), "ElementDefinition.binding.valueSetUri", "startsWith('http:') or startsWith('https') or startsWith('urn:')", true); } - + @Test public void testDecimalRA() throws FileNotFoundException, IOException, FHIRException { RiskAssessment r = new RiskAssessment(); @@ -895,20 +894,20 @@ public class FluentPathTests { sq1.setCode("%"); sq1.setSystem("http://unitsofmeasure.org"); r.addPrediction().setProbability(new Range().setLow(sq).setHigh(sq1)); - testBoolean(r, r.getPrediction().get(0).getProbability(), "RiskAssessment.prediction.probabilityRange", - "(low.empty() or ((low.code = '%') and (low.system = %ucum))) and (high.empty() or ((high.code = '%') and (high.system = %ucum)))", true); + testBoolean(r, r.getPrediction().get(0).getProbability(), "RiskAssessment.prediction.probabilityRange", + "(low.empty() or ((low.code = '%') and (low.system = %ucum))) and (high.empty() or ((high.code = '%') and (high.system = %ucum)))", true); testBoolean(r, r.getPrediction().get(0), "RiskAssessment.prediction", "probability is decimal implies probability.as(decimal) <= 100", true); r.getPrediction().get(0).setProbability(new DecimalType(80)); testBoolean(r, r.getPrediction().get(0), "RiskAssessment.prediction", "probability.as(decimal) <= 100", true); } - - + + @Test public void testAppointment() throws FileNotFoundException, IOException, FHIRException { testBoolean(appointment(), "(start and end) or status = 'proposed' or status = 'cancelled'", true); testBoolean(appointment(), "start.empty() xor end.exists()", true); } - + @Test public void testQuestionnaire() throws FileNotFoundException, IOException, FHIRException { Questionnaire q = (Questionnaire) new JsonParser().parse(new FileInputStream("C:/work/org.hl7.fhir.2016May/build/publish/questionnaire-example-gcs.json")); @@ -920,7 +919,7 @@ public class FluentPathTests { private void testQItem(QuestionnaireItemComponent qi) throws FileNotFoundException, IOException, FHIRException { testBoolean(null, qi, "Questionnaire.item", "(type = 'choice' or type = 'open-choice') or (options.empty() and option.empty())", true); } - + @Test public void testExtensionDefinitions() throws FileNotFoundException, IOException, FHIRException { Bundle b = (Bundle) new JsonParser().parse(new FileInputStream("C:/work/org.hl7.fhir.2016May/build/publish/extension-definitions.json")); @@ -930,7 +929,7 @@ public class FluentPathTests { } private void testStructureDefinition(StructureDefinition sd) throws FileNotFoundException, IOException, FHIRException { - testBoolean(sd, sd, "StructureDefinition", "snapshot.element.tail().all(path.startsWith(%resource.snapshot.element.first().path&'.')) and differential.element.tail().all(path.startsWith(%resource.differential.element.first().path&'.'))", true); + testBoolean(sd, sd, "StructureDefinition", "snapshot.element.tail().all(path.startsWith(%resource.snapshot.element.first().path&'.')) and differential.element.tail().all(path.startsWith(%resource.differential.element.first().path&'.'))", true); } @Test diff --git a/org.hl7.fhir.dstu2016may/src/test/java/org/hl7/fhir/dstu2016may/test/MessageTest.java b/org.hl7.fhir.dstu2016may/src/test/java/org/hl7/fhir/dstu2016may/test/MessageTest.java index 0fe0f1eec..b58bc8cdd 100644 --- a/org.hl7.fhir.dstu2016may/src/test/java/org/hl7/fhir/dstu2016may/test/MessageTest.java +++ b/org.hl7.fhir.dstu2016may/src/test/java/org/hl7/fhir/dstu2016may/test/MessageTest.java @@ -10,7 +10,7 @@ import org.hl7.fhir.dstu2016may.formats.JsonParser; import org.hl7.fhir.dstu2016may.model.Bundle; import org.hl7.fhir.dstu2016may.model.Resource; import org.hl7.fhir.exceptions.FHIRException; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class MessageTest { diff --git a/org.hl7.fhir.dstu2016may/src/test/java/org/hl7/fhir/dstu2016may/test/ParserTests.java b/org.hl7.fhir.dstu2016may/src/test/java/org/hl7/fhir/dstu2016may/test/ParserTests.java index 5acba4cfb..12dd09cd3 100644 --- a/org.hl7.fhir.dstu2016may/src/test/java/org/hl7/fhir/dstu2016may/test/ParserTests.java +++ b/org.hl7.fhir.dstu2016may/src/test/java/org/hl7/fhir/dstu2016may/test/ParserTests.java @@ -12,7 +12,7 @@ import org.hl7.fhir.dstu2016may.model.Resource; import org.hl7.fhir.dstu2016may.utils.SimpleWorkerContext; import org.hl7.fhir.utilities.Utilities; -import junit.framework.Assert; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -38,14 +38,13 @@ public class ParserTests { } } - @SuppressWarnings("deprecation") private void testRoundTrip(String filename, String name) throws Exception { System.out.println(name); Resource r = new org.hl7.fhir.dstu2016may.formats.XmlParser().parse(new FileInputStream(filename)); String fn = makeTempFilename(); new org.hl7.fhir.dstu2016may.formats.XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(fn), r); String msg = TestingUtilities.checkXMLIsSame(filename, fn); - Assert.assertTrue(name+": "+msg, msg == null); + Assertions.assertNull(msg, name + ": " + msg); String j1 = makeTempFilename(); new org.hl7.fhir.dstu2016may.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(j1), r); @@ -57,12 +56,12 @@ public class ParserTests { fn = makeTempFilename(); Manager.compose(TestingUtilities.context, re, new FileOutputStream(fn), FhirFormat.XML, OutputStyle.PRETTY, null); msg = TestingUtilities.checkXMLIsSame(filename, fn); - Assert.assertTrue(name+": "+msg, msg == null); + Assertions.assertNull(msg, name + ": " + msg); String j2 = makeTempFilename(); Manager.compose(TestingUtilities.context, re, new FileOutputStream(j2), FhirFormat.JSON, OutputStyle.PRETTY, null); msg = TestingUtilities.checkJsonIsSame(j1, j2); - Assert.assertTrue(name+": "+msg, msg == null); + Assertions.assertNull(msg, name + ": " + msg); // ok, we've produced equivalent JSON by both methods. // now, we're going to reverse the process @@ -70,7 +69,7 @@ public class ParserTests { fn = makeTempFilename(); new org.hl7.fhir.dstu2016may.formats.JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(fn), r); msg = TestingUtilities.checkJsonIsSame(j2, fn); - Assert.assertTrue(name+": "+msg, msg == null); + Assertions.assertNull(msg, name + ": " + msg); String x1 = makeTempFilename(); new org.hl7.fhir.dstu2016may.formats.XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(x1), r); @@ -78,14 +77,14 @@ public class ParserTests { fn = makeTempFilename(); Manager.compose(TestingUtilities.context, re, new FileOutputStream(fn), FhirFormat.JSON, OutputStyle.PRETTY, null); msg = TestingUtilities.checkJsonIsSame(j1, fn); - Assert.assertTrue(name+": "+msg, msg == null); + Assertions.assertNull(msg, name + ": " + msg); String x2 = makeTempFilename(); Manager.compose(TestingUtilities.context, re, new FileOutputStream(x2), FhirFormat.XML, OutputStyle.PRETTY, null); msg = TestingUtilities.checkXMLIsSame(x1, x2); - Assert.assertTrue(name+": "+msg, msg == null); + Assertions.assertNull(msg, name + ": " + msg); msg = TestingUtilities.checkXMLIsSame(filename, x1); - Assert.assertTrue(name+": "+msg, msg == null); + Assertions.assertNull(msg, name + ": " + msg); } diff --git a/org.hl7.fhir.dstu3/pom.xml b/org.hl7.fhir.dstu3/pom.xml index 0e977721e..aa769f9ce 100644 --- a/org.hl7.fhir.dstu3/pom.xml +++ b/org.hl7.fhir.dstu3/pom.xml @@ -95,6 +95,20 @@ Saxon-HE test + + + + org.junit.jupiter + junit-jupiter-api + ${junit_jupiter_version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit_jupiter_version} + test + diff --git a/org.hl7.fhir.dstu3/src/test/java/org/hl7/fhir/dstu3/test/FluentPathTests.java b/org.hl7.fhir.dstu3/src/test/java/org/hl7/fhir/dstu3/test/FluentPathTests.java index aa61f13a3..81c43f7a5 100644 --- a/org.hl7.fhir.dstu3/src/test/java/org/hl7/fhir/dstu3/test/FluentPathTests.java +++ b/org.hl7.fhir.dstu3/src/test/java/org/hl7/fhir/dstu3/test/FluentPathTests.java @@ -1,9 +1,12 @@ package org.hl7.fhir.dstu3.test; -import junit.framework.Assert; import org.hl7.fhir.dstu3.context.SimpleWorkerContext; import org.hl7.fhir.dstu3.formats.XmlParser; -import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.dstu3.model.Base; +import org.hl7.fhir.dstu3.model.BooleanType; +import org.hl7.fhir.dstu3.model.ExpressionNode; +import org.hl7.fhir.dstu3.model.PrimitiveType; +import org.hl7.fhir.dstu3.model.Resource; import org.hl7.fhir.dstu3.test.support.TestingUtilities; import org.hl7.fhir.dstu3.utils.FHIRPathEngine; import org.hl7.fhir.exceptions.FHIRException; @@ -36,8 +39,8 @@ public class FluentPathTests { @BeforeAll public void setup() throws IOException { - TestingUtilities.context = SimpleWorkerContext.fromPack("C:\\work\\org.hl7.fhir\\build\\publish\\definitions.xml.zip"); - this.fp = new FHIRPathEngine(TestingUtilities.context); + TestingUtilities.context = SimpleWorkerContext.fromPack("C:\\work\\org.hl7.fhir\\build\\publish\\definitions.xml.zip"); + this.fp = new FHIRPathEngine(TestingUtilities.context); } @ParameterizedTest(name = "{index}: file {0}") diff --git a/org.hl7.fhir.dstu3/src/test/java/org/hl7/fhir/dstu3/test/SnapShotGenerationTests.java b/org.hl7.fhir.dstu3/src/test/java/org/hl7/fhir/dstu3/test/SnapShotGenerationTests.java index a8bd318e5..e6f0598a9 100644 --- a/org.hl7.fhir.dstu3/src/test/java/org/hl7/fhir/dstu3/test/SnapShotGenerationTests.java +++ b/org.hl7.fhir.dstu3/src/test/java/org/hl7/fhir/dstu3/test/SnapShotGenerationTests.java @@ -1,18 +1,22 @@ package org.hl7.fhir.dstu3.test; -import junit.framework.Assert; import org.apache.commons.codec.Charsets; import org.apache.commons.io.IOUtils; import org.hl7.fhir.dstu3.conformance.ProfileUtilities; import org.hl7.fhir.dstu3.context.SimpleWorkerContext; import org.hl7.fhir.dstu3.formats.IParser.OutputStyle; import org.hl7.fhir.dstu3.formats.XmlParser; -import org.hl7.fhir.dstu3.model.*; +import org.hl7.fhir.dstu3.model.Base; import org.hl7.fhir.dstu3.model.ExpressionNode.CollectionStatus; +import org.hl7.fhir.dstu3.model.MetadataResource; +import org.hl7.fhir.dstu3.model.Resource; +import org.hl7.fhir.dstu3.model.StructureDefinition; +import org.hl7.fhir.dstu3.model.TestScript; import org.hl7.fhir.dstu3.model.TestScript.SetupActionAssertComponent; import org.hl7.fhir.dstu3.model.TestScript.SetupActionOperationComponent; import org.hl7.fhir.dstu3.model.TestScript.TestScriptFixtureComponent; import org.hl7.fhir.dstu3.model.TestScript.TestScriptTestComponent; +import org.hl7.fhir.dstu3.model.TypeDetails; import org.hl7.fhir.dstu3.test.support.TestingUtilities; import org.hl7.fhir.dstu3.utils.CodingUtilities; import org.hl7.fhir.dstu3.utils.FHIRPathEngine; @@ -22,6 +26,7 @@ import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRFormatError; import org.hl7.fhir.exceptions.PathEngineException; import org.hl7.fhir.utilities.Utilities; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -29,7 +34,12 @@ import org.junit.jupiter.params.provider.MethodSource; import java.io.FileOutputStream; import java.io.IOException; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.stream.Stream; @Disabled @@ -82,7 +92,7 @@ public class SnapShotGenerationTests { //ok, now the asserts: for (int i = 1; i < test.getAction().size(); i++) { SetupActionAssertComponent a = test.getAction().get(i).getAssert(); - Assert.assertTrue(a.getLabel() + ": " + a.getDescription(), fp.evaluateToBoolean(source, source, a.getExpression())); + Assertions.assertTrue(fp.evaluateToBoolean(source, source, a.getExpression()), a.getLabel() + ": " + a.getDescription()); } } diff --git a/org.hl7.fhir.dstu3/src/test/java/org/hl7/fhir/dstu3/test/TurtleTests.java b/org.hl7.fhir.dstu3/src/test/java/org/hl7/fhir/dstu3/test/TurtleTests.java index c356370a7..27adbdfcb 100644 --- a/org.hl7.fhir.dstu3/src/test/java/org/hl7/fhir/dstu3/test/TurtleTests.java +++ b/org.hl7.fhir.dstu3/src/test/java/org/hl7/fhir/dstu3/test/TurtleTests.java @@ -1,8 +1,8 @@ package org.hl7.fhir.dstu3.test; -import junit.framework.Assert; import org.hl7.fhir.dstu3.utils.formats.Turtle; import org.hl7.fhir.utilities.TextFile; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -17,9 +17,9 @@ public class TurtleTests { String s = TextFile.fileToString(filename); Turtle ttl = new Turtle(); ttl.parse(s); - Assert.assertTrue(ok); + Assertions.assertTrue(ok); } catch (Exception e) { - Assert.assertTrue(e.getMessage(), !ok); + Assertions.assertFalse(ok, e.getMessage()); } } diff --git a/org.hl7.fhir.r4/pom.xml b/org.hl7.fhir.r4/pom.xml index 418f5bf8d..d603fbe0e 100644 --- a/org.hl7.fhir.r4/pom.xml +++ b/org.hl7.fhir.r4/pom.xml @@ -101,6 +101,20 @@ Saxon-HE test + + + + org.junit.jupiter + junit-jupiter-api + ${junit_jupiter_version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit_jupiter_version} + test + diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Duration.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Duration.java index 55e0f2cad..17b6ce0ad 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Duration.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/Duration.java @@ -9,9 +9,9 @@ package org.hl7.fhir.r4.model; * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -50,119 +50,130 @@ package org.hl7.fhir.r4.model; */ // Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0 -import java.util.List; +import ca.uhn.fhir.model.api.annotation.DatatypeDef; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.instance.model.api.ICompositeType; -import ca.uhn.fhir.model.api.annotation.DatatypeDef; +import java.util.List; + /** * A length of time. */ -@DatatypeDef(name="Duration") +@DatatypeDef(name = "Duration") public class Duration extends Quantity implements ICompositeType { - private static final long serialVersionUID = 0L; + private static final long serialVersionUID = 0L; /** * Constructor */ - public Duration() { - super(); + public Duration() { + super(); + } + + protected void listChildren(List children) { + super.listChildren(children); + } + + @Override + public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { + switch (_hash) { + default: + return super.getNamedProperty(_hash, _name, _checkValid); } - protected void listChildren(List children) { - super.listChildren(children); - } + } - @Override - public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { - switch (_hash) { - default: return super.getNamedProperty(_hash, _name, _checkValid); - } + @Override + public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { + switch (hash) { + default: + return super.getProperty(hash, name, checkValid); + } - } + } - @Override - public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { - switch (hash) { - default: return super.getProperty(hash, name, checkValid); - } + @Override + public Base setProperty(int hash, String name, Base value) throws FHIRException { + switch (hash) { + default: + return super.setProperty(hash, name, value); + } - } + } - @Override - public Base setProperty(int hash, String name, Base value) throws FHIRException { - switch (hash) { - default: return super.setProperty(hash, name, value); - } + @Override + public Base setProperty(String name, Base value) throws FHIRException { + return super.setProperty(name, value); + } - } + @Override + public Base makeProperty(int hash, String name) throws FHIRException { + switch (hash) { + default: + return super.makeProperty(hash, name); + } - @Override - public Base setProperty(String name, Base value) throws FHIRException { - return super.setProperty(name, value); - } + } - @Override - public Base makeProperty(int hash, String name) throws FHIRException { - switch (hash) { - default: return super.makeProperty(hash, name); - } + @Override + public String[] getTypesForProperty(int hash, String name) throws FHIRException { + switch (hash) { + default: + return super.getTypesForProperty(hash, name); + } - } + } - @Override - public String[] getTypesForProperty(int hash, String name) throws FHIRException { - switch (hash) { - default: return super.getTypesForProperty(hash, name); - } - - } - - @Override - public Base addChild(String name) throws FHIRException { - return super.addChild(name); - } + @Override + public Base addChild(String name) throws FHIRException { + return super.addChild(name); + } public String fhirType() { return "Duration"; } - public Duration copy() { - Duration dst = new Duration(); - copyValues(dst); - return dst; - } + public Duration copy() { + Duration dst = new Duration(); + copyValues(dst); + dst.value = value == null ? null : value.copy(); + dst.comparator = comparator == null ? null : comparator.copy(); + dst.unit = unit == null ? null : unit.copy(); + dst.system = system == null ? null : system.copy(); + dst.code = code == null ? null : code.copy(); + return dst; + } - protected Duration typedCopy() { - return copy(); - } + protected Duration typedCopy() { + return copy(); + } - @Override - public boolean equalsDeep(Base other_) { - if (!super.equalsDeep(other_)) - return false; - if (!(other_ instanceof Duration)) - return false; - Duration o = (Duration) other_; - return true; - } + @Override + public boolean equalsDeep(Base other_) { + if (!super.equalsDeep(other_)) + return false; + if (!(other_ instanceof Duration)) + return false; + Duration o = (Duration) other_; + return true; + } - @Override - public boolean equalsShallow(Base other_) { - if (!super.equalsShallow(other_)) - return false; - if (!(other_ instanceof Duration)) - return false; - Duration o = (Duration) other_; - return true; - } + @Override + public boolean equalsShallow(Base other_) { + if (!super.equalsShallow(other_)) + return false; + if (!(other_ instanceof Duration)) + return false; + Duration o = (Duration) other_; + return true; + } - public boolean isEmpty() { - return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(); - } + public boolean isEmpty() { + return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(); + } } diff --git a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/MedicationRequest.java b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/MedicationRequest.java index b6491a176..1b5b01a17 100644 --- a/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/MedicationRequest.java +++ b/org.hl7.fhir.r4/src/main/java/org/hl7/fhir/r4/model/MedicationRequest.java @@ -9,9 +9,9 @@ package org.hl7.fhir.r4.model; * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -23,215 +23,259 @@ package org.hl7.fhir.r4.model; /* Copyright (c) 2011+, HL7, Inc. All rights reserved. - - Redistribution and use in source and binary forms, with or without modification, + + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this + + * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - * Neither the name of HL7 nor the names of its contributors may be used to - endorse or promote products derived from this software without specific + * Neither the name of HL7 nor the names of its contributors may be used to + endorse or promote products derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + */ // Generated on Thu, Dec 13, 2018 14:07+1100 for FHIR v4.0.0 -import java.util.ArrayList; -import java.util.Date; -import java.util.List; - -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.instance.model.api.IBaseBackboneElement; import ca.uhn.fhir.model.api.annotation.Block; import ca.uhn.fhir.model.api.annotation.Child; import ca.uhn.fhir.model.api.annotation.Description; import ca.uhn.fhir.model.api.annotation.ResourceDef; import ca.uhn.fhir.model.api.annotation.SearchParamDefinition; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.instance.model.api.IBaseBackboneElement; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + /** * An order or request for both supply of the medication and the instructions for administration of the medication to a patient. The resource is called "MedicationRequest" rather than "MedicationPrescription" or "MedicationOrder" to generalize the use across inpatient and outpatient settings, including care plans, etc., and to harmonize with workflow patterns. */ -@ResourceDef(name="MedicationRequest", profile="http://hl7.org/fhir/StructureDefinition/MedicationRequest") +@ResourceDef(name = "MedicationRequest", profile = "http://hl7.org/fhir/StructureDefinition/MedicationRequest") public class MedicationRequest extends DomainResource { - public enum MedicationRequestStatus { - /** - * The prescription is 'actionable', but not all actions that are implied by it have occurred yet. - */ - ACTIVE, - /** - * Actions implied by the prescription are to be temporarily halted, but are expected to continue later. May also be called 'suspended'. - */ - ONHOLD, - /** - * The prescription has been withdrawn before any administrations have occurred - */ - CANCELLED, - /** - * All actions that are implied by the prescription have occurred. - */ - COMPLETED, - /** - * Some of the actions that are implied by the medication request may have occurred. For example, the medication may have been dispensed and the patient may have taken some of the medication. Clinical decision support systems should take this status into account - */ - ENTEREDINERROR, - /** - * Actions implied by the prescription are to be permanently halted, before all of the administrations occurred. This should not be used if the original order was entered in error - */ - STOPPED, - /** - * The prescription is not yet 'actionable', e.g. it is a work in progress, requires sign-off, verification or needs to be run through decision support process. - */ - DRAFT, - /** - * The authoring/source system does not know which of the status values currently applies for this observation. Note: This concept is not to be used for 'other' - one of the listed statuses is presumed to apply, but the authoring/source system does not know which. - */ - UNKNOWN, - /** - * added to help the parsers with the generic types - */ - NULL; - public static MedicationRequestStatus fromCode(String codeString) throws FHIRException { - if (codeString == null || "".equals(codeString)) - return null; - if ("active".equals(codeString)) - return ACTIVE; - if ("on-hold".equals(codeString)) - return ONHOLD; - if ("cancelled".equals(codeString)) - return CANCELLED; - if ("completed".equals(codeString)) - return COMPLETED; - if ("entered-in-error".equals(codeString)) - return ENTEREDINERROR; - if ("stopped".equals(codeString)) - return STOPPED; - if ("draft".equals(codeString)) - return DRAFT; - if ("unknown".equals(codeString)) - return UNKNOWN; - if (Configuration.isAcceptInvalidEnums()) - return null; - else - throw new FHIRException("Unknown MedicationRequestStatus code '"+codeString+"'"); - } - public String toCode() { - switch (this) { - case ACTIVE: return "active"; - case ONHOLD: return "on-hold"; - case CANCELLED: return "cancelled"; - case COMPLETED: return "completed"; - case ENTEREDINERROR: return "entered-in-error"; - case STOPPED: return "stopped"; - case DRAFT: return "draft"; - case UNKNOWN: return "unknown"; - default: return "?"; - } - } - public String getSystem() { - switch (this) { - case ACTIVE: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status"; - case ONHOLD: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status"; - case CANCELLED: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status"; - case COMPLETED: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status"; - case ENTEREDINERROR: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status"; - case STOPPED: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status"; - case DRAFT: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status"; - case UNKNOWN: return "http://hl7.org/fhir/CodeSystem/medicationrequest-status"; - default: return "?"; - } - } - public String getDefinition() { - switch (this) { - case ACTIVE: return "The prescription is 'actionable', but not all actions that are implied by it have occurred yet."; - case ONHOLD: return "Actions implied by the prescription are to be temporarily halted, but are expected to continue later. May also be called 'suspended'."; - case CANCELLED: return "The prescription has been withdrawn before any administrations have occurred"; - case COMPLETED: return "All actions that are implied by the prescription have occurred."; - case ENTEREDINERROR: return "Some of the actions that are implied by the medication request may have occurred. For example, the medication may have been dispensed and the patient may have taken some of the medication. Clinical decision support systems should take this status into account"; - case STOPPED: return "Actions implied by the prescription are to be permanently halted, before all of the administrations occurred. This should not be used if the original order was entered in error"; - case DRAFT: return "The prescription is not yet 'actionable', e.g. it is a work in progress, requires sign-off, verification or needs to be run through decision support process."; - case UNKNOWN: return "The authoring/source system does not know which of the status values currently applies for this observation. Note: This concept is not to be used for 'other' - one of the listed statuses is presumed to apply, but the authoring/source system does not know which."; - default: return "?"; - } - } - public String getDisplay() { - switch (this) { - case ACTIVE: return "Active"; - case ONHOLD: return "On Hold"; - case CANCELLED: return "Cancelled"; - case COMPLETED: return "Completed"; - case ENTEREDINERROR: return "Entered in Error"; - case STOPPED: return "Stopped"; - case DRAFT: return "Draft"; - case UNKNOWN: return "Unknown"; - default: return "?"; - } - } + public enum MedicationRequestStatus { + /** + * The prescription is 'actionable', but not all actions that are implied by it have occurred yet. + */ + ACTIVE, + /** + * Actions implied by the prescription are to be temporarily halted, but are expected to continue later. May also be called 'suspended'. + */ + ONHOLD, + /** + * The prescription has been withdrawn before any administrations have occurred + */ + CANCELLED, + /** + * All actions that are implied by the prescription have occurred. + */ + COMPLETED, + /** + * Some of the actions that are implied by the medication request may have occurred. For example, the medication may have been dispensed and the patient may have taken some of the medication. Clinical decision support systems should take this status into account + */ + ENTEREDINERROR, + /** + * Actions implied by the prescription are to be permanently halted, before all of the administrations occurred. This should not be used if the original order was entered in error + */ + STOPPED, + /** + * The prescription is not yet 'actionable', e.g. it is a work in progress, requires sign-off, verification or needs to be run through decision support process. + */ + DRAFT, + /** + * The authoring/source system does not know which of the status values currently applies for this observation. Note: This concept is not to be used for 'other' - one of the listed statuses is presumed to apply, but the authoring/source system does not know which. + */ + UNKNOWN, + /** + * added to help the parsers with the generic types + */ + NULL; + + public static MedicationRequestStatus fromCode(String codeString) throws FHIRException { + if (codeString == null || "".equals(codeString)) + return null; + if ("active".equals(codeString)) + return ACTIVE; + if ("on-hold".equals(codeString)) + return ONHOLD; + if ("cancelled".equals(codeString)) + return CANCELLED; + if ("completed".equals(codeString)) + return COMPLETED; + if ("entered-in-error".equals(codeString)) + return ENTEREDINERROR; + if ("stopped".equals(codeString)) + return STOPPED; + if ("draft".equals(codeString)) + return DRAFT; + if ("unknown".equals(codeString)) + return UNKNOWN; + if (Configuration.isAcceptInvalidEnums()) + return null; + else + throw new FHIRException("Unknown MedicationRequestStatus code '" + codeString + "'"); } + public String toCode() { + switch (this) { + case ACTIVE: + return "active"; + case ONHOLD: + return "on-hold"; + case CANCELLED: + return "cancelled"; + case COMPLETED: + return "completed"; + case ENTEREDINERROR: + return "entered-in-error"; + case STOPPED: + return "stopped"; + case DRAFT: + return "draft"; + case UNKNOWN: + return "unknown"; + default: + return "?"; + } + } + + public String getSystem() { + switch (this) { + case ACTIVE: + return "http://hl7.org/fhir/CodeSystem/medicationrequest-status"; + case ONHOLD: + return "http://hl7.org/fhir/CodeSystem/medicationrequest-status"; + case CANCELLED: + return "http://hl7.org/fhir/CodeSystem/medicationrequest-status"; + case COMPLETED: + return "http://hl7.org/fhir/CodeSystem/medicationrequest-status"; + case ENTEREDINERROR: + return "http://hl7.org/fhir/CodeSystem/medicationrequest-status"; + case STOPPED: + return "http://hl7.org/fhir/CodeSystem/medicationrequest-status"; + case DRAFT: + return "http://hl7.org/fhir/CodeSystem/medicationrequest-status"; + case UNKNOWN: + return "http://hl7.org/fhir/CodeSystem/medicationrequest-status"; + default: + return "?"; + } + } + + public String getDefinition() { + switch (this) { + case ACTIVE: + return "The prescription is 'actionable', but not all actions that are implied by it have occurred yet."; + case ONHOLD: + return "Actions implied by the prescription are to be temporarily halted, but are expected to continue later. May also be called 'suspended'."; + case CANCELLED: + return "The prescription has been withdrawn before any administrations have occurred"; + case COMPLETED: + return "All actions that are implied by the prescription have occurred."; + case ENTEREDINERROR: + return "Some of the actions that are implied by the medication request may have occurred. For example, the medication may have been dispensed and the patient may have taken some of the medication. Clinical decision support systems should take this status into account"; + case STOPPED: + return "Actions implied by the prescription are to be permanently halted, before all of the administrations occurred. This should not be used if the original order was entered in error"; + case DRAFT: + return "The prescription is not yet 'actionable', e.g. it is a work in progress, requires sign-off, verification or needs to be run through decision support process."; + case UNKNOWN: + return "The authoring/source system does not know which of the status values currently applies for this observation. Note: This concept is not to be used for 'other' - one of the listed statuses is presumed to apply, but the authoring/source system does not know which."; + default: + return "?"; + } + } + + public String getDisplay() { + switch (this) { + case ACTIVE: + return "Active"; + case ONHOLD: + return "On Hold"; + case CANCELLED: + return "Cancelled"; + case COMPLETED: + return "Completed"; + case ENTEREDINERROR: + return "Entered in Error"; + case STOPPED: + return "Stopped"; + case DRAFT: + return "Draft"; + case UNKNOWN: + return "Unknown"; + default: + return "?"; + } + } + } + public static class MedicationRequestStatusEnumFactory implements EnumFactory { public MedicationRequestStatus fromCode(String codeString) throws IllegalArgumentException { if (codeString == null || "".equals(codeString)) - if (codeString == null || "".equals(codeString)) - return null; - if ("active".equals(codeString)) - return MedicationRequestStatus.ACTIVE; - if ("on-hold".equals(codeString)) - return MedicationRequestStatus.ONHOLD; - if ("cancelled".equals(codeString)) - return MedicationRequestStatus.CANCELLED; - if ("completed".equals(codeString)) - return MedicationRequestStatus.COMPLETED; - if ("entered-in-error".equals(codeString)) - return MedicationRequestStatus.ENTEREDINERROR; - if ("stopped".equals(codeString)) - return MedicationRequestStatus.STOPPED; - if ("draft".equals(codeString)) - return MedicationRequestStatus.DRAFT; - if ("unknown".equals(codeString)) - return MedicationRequestStatus.UNKNOWN; - throw new IllegalArgumentException("Unknown MedicationRequestStatus code '"+codeString+"'"); - } - public Enumeration fromType(Base code) throws FHIRException { - if (code == null) - return null; - if (code.isEmpty()) - return new Enumeration(this); - String codeString = ((PrimitiveType) code).asStringValue(); - if (codeString == null || "".equals(codeString)) - return null; - if ("active".equals(codeString)) - return new Enumeration(this, MedicationRequestStatus.ACTIVE); - if ("on-hold".equals(codeString)) - return new Enumeration(this, MedicationRequestStatus.ONHOLD); - if ("cancelled".equals(codeString)) - return new Enumeration(this, MedicationRequestStatus.CANCELLED); - if ("completed".equals(codeString)) - return new Enumeration(this, MedicationRequestStatus.COMPLETED); - if ("entered-in-error".equals(codeString)) - return new Enumeration(this, MedicationRequestStatus.ENTEREDINERROR); - if ("stopped".equals(codeString)) - return new Enumeration(this, MedicationRequestStatus.STOPPED); - if ("draft".equals(codeString)) - return new Enumeration(this, MedicationRequestStatus.DRAFT); - if ("unknown".equals(codeString)) - return new Enumeration(this, MedicationRequestStatus.UNKNOWN); - throw new FHIRException("Unknown MedicationRequestStatus code '"+codeString+"'"); - } + if (codeString == null || "".equals(codeString)) + return null; + if ("active".equals(codeString)) + return MedicationRequestStatus.ACTIVE; + if ("on-hold".equals(codeString)) + return MedicationRequestStatus.ONHOLD; + if ("cancelled".equals(codeString)) + return MedicationRequestStatus.CANCELLED; + if ("completed".equals(codeString)) + return MedicationRequestStatus.COMPLETED; + if ("entered-in-error".equals(codeString)) + return MedicationRequestStatus.ENTEREDINERROR; + if ("stopped".equals(codeString)) + return MedicationRequestStatus.STOPPED; + if ("draft".equals(codeString)) + return MedicationRequestStatus.DRAFT; + if ("unknown".equals(codeString)) + return MedicationRequestStatus.UNKNOWN; + throw new IllegalArgumentException("Unknown MedicationRequestStatus code '" + codeString + "'"); + } + + public Enumeration fromType(Base code) throws FHIRException { + if (code == null) + return null; + if (code.isEmpty()) + return new Enumeration(this); + String codeString = ((PrimitiveType) code).asStringValue(); + if (codeString == null || "".equals(codeString)) + return null; + if ("active".equals(codeString)) + return new Enumeration(this, MedicationRequestStatus.ACTIVE); + if ("on-hold".equals(codeString)) + return new Enumeration(this, MedicationRequestStatus.ONHOLD); + if ("cancelled".equals(codeString)) + return new Enumeration(this, MedicationRequestStatus.CANCELLED); + if ("completed".equals(codeString)) + return new Enumeration(this, MedicationRequestStatus.COMPLETED); + if ("entered-in-error".equals(codeString)) + return new Enumeration(this, MedicationRequestStatus.ENTEREDINERROR); + if ("stopped".equals(codeString)) + return new Enumeration(this, MedicationRequestStatus.STOPPED); + if ("draft".equals(codeString)) + return new Enumeration(this, MedicationRequestStatus.DRAFT); + if ("unknown".equals(codeString)) + return new Enumeration(this, MedicationRequestStatus.UNKNOWN); + throw new FHIRException("Unknown MedicationRequestStatus code '" + codeString + "'"); + } + public String toCode(MedicationRequestStatus code) { if (code == MedicationRequestStatus.ACTIVE) return "active"; @@ -250,176 +294,220 @@ public class MedicationRequest extends DomainResource { if (code == MedicationRequestStatus.UNKNOWN) return "unknown"; return "?"; - } + } + public String toSystem(MedicationRequestStatus code) { return code.getSystem(); + } + } + + public enum MedicationRequestIntent { + /** + * The request is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and without providing an authorization to act + */ + PROPOSAL, + /** + * The request represents an intention to ensure something occurs without providing an authorization for others to act. + */ + PLAN, + /** + * The request represents a request/demand and authorization for action + */ + ORDER, + /** + * The request represents the original authorization for the medication request. + */ + ORIGINALORDER, + /** + * The request represents an automatically generated supplemental authorization for action based on a parent authorization together with initial results of the action taken against that parent authorization.. + */ + REFLEXORDER, + /** + * The request represents the view of an authorization instantiated by a fulfilling system representing the details of the fulfiller's intention to act upon a submitted order. + */ + FILLERORDER, + /** + * The request represents an instance for the particular order, for example a medication administration record. + */ + INSTANCEORDER, + /** + * The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests. + */ + OPTION, + /** + * added to help the parsers with the generic types + */ + NULL; + + public static MedicationRequestIntent fromCode(String codeString) throws FHIRException { + if (codeString == null || "".equals(codeString)) + return null; + if ("proposal".equals(codeString)) + return PROPOSAL; + if ("plan".equals(codeString)) + return PLAN; + if ("order".equals(codeString)) + return ORDER; + if ("original-order".equals(codeString)) + return ORIGINALORDER; + if ("reflex-order".equals(codeString)) + return REFLEXORDER; + if ("filler-order".equals(codeString)) + return FILLERORDER; + if ("instance-order".equals(codeString)) + return INSTANCEORDER; + if ("option".equals(codeString)) + return OPTION; + if (Configuration.isAcceptInvalidEnums()) + return null; + else + throw new FHIRException("Unknown MedicationRequestIntent code '" + codeString + "'"); + } + + public String toCode() { + switch (this) { + case PROPOSAL: + return "proposal"; + case PLAN: + return "plan"; + case ORDER: + return "order"; + case ORIGINALORDER: + return "original-order"; + case REFLEXORDER: + return "reflex-order"; + case FILLERORDER: + return "filler-order"; + case INSTANCEORDER: + return "instance-order"; + case OPTION: + return "option"; + default: + return "?"; } } - public enum MedicationRequestIntent { - /** - * The request is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and without providing an authorization to act - */ - PROPOSAL, - /** - * The request represents an intention to ensure something occurs without providing an authorization for others to act. - */ - PLAN, - /** - * The request represents a request/demand and authorization for action - */ - ORDER, - /** - * The request represents the original authorization for the medication request. - */ - ORIGINALORDER, - /** - * The request represents an automatically generated supplemental authorization for action based on a parent authorization together with initial results of the action taken against that parent authorization.. - */ - REFLEXORDER, - /** - * The request represents the view of an authorization instantiated by a fulfilling system representing the details of the fulfiller's intention to act upon a submitted order. - */ - FILLERORDER, - /** - * The request represents an instance for the particular order, for example a medication administration record. - */ - INSTANCEORDER, - /** - * The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests. - */ - OPTION, - /** - * added to help the parsers with the generic types - */ - NULL; - public static MedicationRequestIntent fromCode(String codeString) throws FHIRException { - if (codeString == null || "".equals(codeString)) - return null; - if ("proposal".equals(codeString)) - return PROPOSAL; - if ("plan".equals(codeString)) - return PLAN; - if ("order".equals(codeString)) - return ORDER; - if ("original-order".equals(codeString)) - return ORIGINALORDER; - if ("reflex-order".equals(codeString)) - return REFLEXORDER; - if ("filler-order".equals(codeString)) - return FILLERORDER; - if ("instance-order".equals(codeString)) - return INSTANCEORDER; - if ("option".equals(codeString)) - return OPTION; - if (Configuration.isAcceptInvalidEnums()) - return null; - else - throw new FHIRException("Unknown MedicationRequestIntent code '"+codeString+"'"); - } - public String toCode() { - switch (this) { - case PROPOSAL: return "proposal"; - case PLAN: return "plan"; - case ORDER: return "order"; - case ORIGINALORDER: return "original-order"; - case REFLEXORDER: return "reflex-order"; - case FILLERORDER: return "filler-order"; - case INSTANCEORDER: return "instance-order"; - case OPTION: return "option"; - default: return "?"; - } - } - public String getSystem() { - switch (this) { - case PROPOSAL: return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"; - case PLAN: return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"; - case ORDER: return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"; - case ORIGINALORDER: return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"; - case REFLEXORDER: return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"; - case FILLERORDER: return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"; - case INSTANCEORDER: return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"; - case OPTION: return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"; - default: return "?"; - } - } - public String getDefinition() { - switch (this) { - case PROPOSAL: return "The request is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and without providing an authorization to act"; - case PLAN: return "The request represents an intention to ensure something occurs without providing an authorization for others to act."; - case ORDER: return "The request represents a request/demand and authorization for action"; - case ORIGINALORDER: return "The request represents the original authorization for the medication request."; - case REFLEXORDER: return "The request represents an automatically generated supplemental authorization for action based on a parent authorization together with initial results of the action taken against that parent authorization.."; - case FILLERORDER: return "The request represents the view of an authorization instantiated by a fulfilling system representing the details of the fulfiller's intention to act upon a submitted order."; - case INSTANCEORDER: return "The request represents an instance for the particular order, for example a medication administration record."; - case OPTION: return "The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests."; - default: return "?"; - } - } - public String getDisplay() { - switch (this) { - case PROPOSAL: return "Proposal"; - case PLAN: return "Plan"; - case ORDER: return "Order"; - case ORIGINALORDER: return "Original Order"; - case REFLEXORDER: return "Reflex Order"; - case FILLERORDER: return "Filler Order"; - case INSTANCEORDER: return "Instance Order"; - case OPTION: return "Option"; - default: return "?"; - } - } + public String getSystem() { + switch (this) { + case PROPOSAL: + return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"; + case PLAN: + return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"; + case ORDER: + return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"; + case ORIGINALORDER: + return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"; + case REFLEXORDER: + return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"; + case FILLERORDER: + return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"; + case INSTANCEORDER: + return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"; + case OPTION: + return "http://hl7.org/fhir/CodeSystem/medicationrequest-intent"; + default: + return "?"; + } } + public String getDefinition() { + switch (this) { + case PROPOSAL: + return "The request is a suggestion made by someone/something that doesn't have an intention to ensure it occurs and without providing an authorization to act"; + case PLAN: + return "The request represents an intention to ensure something occurs without providing an authorization for others to act."; + case ORDER: + return "The request represents a request/demand and authorization for action"; + case ORIGINALORDER: + return "The request represents the original authorization for the medication request."; + case REFLEXORDER: + return "The request represents an automatically generated supplemental authorization for action based on a parent authorization together with initial results of the action taken against that parent authorization.."; + case FILLERORDER: + return "The request represents the view of an authorization instantiated by a fulfilling system representing the details of the fulfiller's intention to act upon a submitted order."; + case INSTANCEORDER: + return "The request represents an instance for the particular order, for example a medication administration record."; + case OPTION: + return "The request represents a component or option for a RequestGroup that establishes timing, conditionality and/or other constraints among a set of requests."; + default: + return "?"; + } + } + + public String getDisplay() { + switch (this) { + case PROPOSAL: + return "Proposal"; + case PLAN: + return "Plan"; + case ORDER: + return "Order"; + case ORIGINALORDER: + return "Original Order"; + case REFLEXORDER: + return "Reflex Order"; + case FILLERORDER: + return "Filler Order"; + case INSTANCEORDER: + return "Instance Order"; + case OPTION: + return "Option"; + default: + return "?"; + } + } + } + public static class MedicationRequestIntentEnumFactory implements EnumFactory { public MedicationRequestIntent fromCode(String codeString) throws IllegalArgumentException { if (codeString == null || "".equals(codeString)) - if (codeString == null || "".equals(codeString)) - return null; - if ("proposal".equals(codeString)) - return MedicationRequestIntent.PROPOSAL; - if ("plan".equals(codeString)) - return MedicationRequestIntent.PLAN; - if ("order".equals(codeString)) - return MedicationRequestIntent.ORDER; - if ("original-order".equals(codeString)) - return MedicationRequestIntent.ORIGINALORDER; - if ("reflex-order".equals(codeString)) - return MedicationRequestIntent.REFLEXORDER; - if ("filler-order".equals(codeString)) - return MedicationRequestIntent.FILLERORDER; - if ("instance-order".equals(codeString)) - return MedicationRequestIntent.INSTANCEORDER; - if ("option".equals(codeString)) - return MedicationRequestIntent.OPTION; - throw new IllegalArgumentException("Unknown MedicationRequestIntent code '"+codeString+"'"); - } - public Enumeration fromType(Base code) throws FHIRException { - if (code == null) - return null; - if (code.isEmpty()) - return new Enumeration(this); - String codeString = ((PrimitiveType) code).asStringValue(); - if (codeString == null || "".equals(codeString)) - return null; - if ("proposal".equals(codeString)) - return new Enumeration(this, MedicationRequestIntent.PROPOSAL); - if ("plan".equals(codeString)) - return new Enumeration(this, MedicationRequestIntent.PLAN); - if ("order".equals(codeString)) - return new Enumeration(this, MedicationRequestIntent.ORDER); - if ("original-order".equals(codeString)) - return new Enumeration(this, MedicationRequestIntent.ORIGINALORDER); - if ("reflex-order".equals(codeString)) - return new Enumeration(this, MedicationRequestIntent.REFLEXORDER); - if ("filler-order".equals(codeString)) - return new Enumeration(this, MedicationRequestIntent.FILLERORDER); - if ("instance-order".equals(codeString)) - return new Enumeration(this, MedicationRequestIntent.INSTANCEORDER); - if ("option".equals(codeString)) - return new Enumeration(this, MedicationRequestIntent.OPTION); - throw new FHIRException("Unknown MedicationRequestIntent code '"+codeString+"'"); - } + if (codeString == null || "".equals(codeString)) + return null; + if ("proposal".equals(codeString)) + return MedicationRequestIntent.PROPOSAL; + if ("plan".equals(codeString)) + return MedicationRequestIntent.PLAN; + if ("order".equals(codeString)) + return MedicationRequestIntent.ORDER; + if ("original-order".equals(codeString)) + return MedicationRequestIntent.ORIGINALORDER; + if ("reflex-order".equals(codeString)) + return MedicationRequestIntent.REFLEXORDER; + if ("filler-order".equals(codeString)) + return MedicationRequestIntent.FILLERORDER; + if ("instance-order".equals(codeString)) + return MedicationRequestIntent.INSTANCEORDER; + if ("option".equals(codeString)) + return MedicationRequestIntent.OPTION; + throw new IllegalArgumentException("Unknown MedicationRequestIntent code '" + codeString + "'"); + } + + public Enumeration fromType(Base code) throws FHIRException { + if (code == null) + return null; + if (code.isEmpty()) + return new Enumeration(this); + String codeString = ((PrimitiveType) code).asStringValue(); + if (codeString == null || "".equals(codeString)) + return null; + if ("proposal".equals(codeString)) + return new Enumeration(this, MedicationRequestIntent.PROPOSAL); + if ("plan".equals(codeString)) + return new Enumeration(this, MedicationRequestIntent.PLAN); + if ("order".equals(codeString)) + return new Enumeration(this, MedicationRequestIntent.ORDER); + if ("original-order".equals(codeString)) + return new Enumeration(this, MedicationRequestIntent.ORIGINALORDER); + if ("reflex-order".equals(codeString)) + return new Enumeration(this, MedicationRequestIntent.REFLEXORDER); + if ("filler-order".equals(codeString)) + return new Enumeration(this, MedicationRequestIntent.FILLERORDER); + if ("instance-order".equals(codeString)) + return new Enumeration(this, MedicationRequestIntent.INSTANCEORDER); + if ("option".equals(codeString)) + return new Enumeration(this, MedicationRequestIntent.OPTION); + throw new FHIRException("Unknown MedicationRequestIntent code '" + codeString + "'"); + } + public String toCode(MedicationRequestIntent code) { if (code == MedicationRequestIntent.PROPOSAL) return "proposal"; @@ -438,120 +526,148 @@ public class MedicationRequest extends DomainResource { if (code == MedicationRequestIntent.OPTION) return "option"; return "?"; - } + } + public String toSystem(MedicationRequestIntent code) { return code.getSystem(); + } + } + + public enum MedicationRequestPriority { + /** + * The request has normal priority. + */ + ROUTINE, + /** + * The request should be actioned promptly - higher priority than routine. + */ + URGENT, + /** + * The request should be actioned as soon as possible - higher priority than urgent. + */ + ASAP, + /** + * The request should be actioned immediately - highest possible priority. E.g. an emergency. + */ + STAT, + /** + * added to help the parsers with the generic types + */ + NULL; + + public static MedicationRequestPriority fromCode(String codeString) throws FHIRException { + if (codeString == null || "".equals(codeString)) + return null; + if ("routine".equals(codeString)) + return ROUTINE; + if ("urgent".equals(codeString)) + return URGENT; + if ("asap".equals(codeString)) + return ASAP; + if ("stat".equals(codeString)) + return STAT; + if (Configuration.isAcceptInvalidEnums()) + return null; + else + throw new FHIRException("Unknown MedicationRequestPriority code '" + codeString + "'"); + } + + public String toCode() { + switch (this) { + case ROUTINE: + return "routine"; + case URGENT: + return "urgent"; + case ASAP: + return "asap"; + case STAT: + return "stat"; + default: + return "?"; } } - public enum MedicationRequestPriority { - /** - * The request has normal priority. - */ - ROUTINE, - /** - * The request should be actioned promptly - higher priority than routine. - */ - URGENT, - /** - * The request should be actioned as soon as possible - higher priority than urgent. - */ - ASAP, - /** - * The request should be actioned immediately - highest possible priority. E.g. an emergency. - */ - STAT, - /** - * added to help the parsers with the generic types - */ - NULL; - public static MedicationRequestPriority fromCode(String codeString) throws FHIRException { - if (codeString == null || "".equals(codeString)) - return null; - if ("routine".equals(codeString)) - return ROUTINE; - if ("urgent".equals(codeString)) - return URGENT; - if ("asap".equals(codeString)) - return ASAP; - if ("stat".equals(codeString)) - return STAT; - if (Configuration.isAcceptInvalidEnums()) - return null; - else - throw new FHIRException("Unknown MedicationRequestPriority code '"+codeString+"'"); - } - public String toCode() { - switch (this) { - case ROUTINE: return "routine"; - case URGENT: return "urgent"; - case ASAP: return "asap"; - case STAT: return "stat"; - default: return "?"; - } - } - public String getSystem() { - switch (this) { - case ROUTINE: return "http://hl7.org/fhir/request-priority"; - case URGENT: return "http://hl7.org/fhir/request-priority"; - case ASAP: return "http://hl7.org/fhir/request-priority"; - case STAT: return "http://hl7.org/fhir/request-priority"; - default: return "?"; - } - } - public String getDefinition() { - switch (this) { - case ROUTINE: return "The request has normal priority."; - case URGENT: return "The request should be actioned promptly - higher priority than routine."; - case ASAP: return "The request should be actioned as soon as possible - higher priority than urgent."; - case STAT: return "The request should be actioned immediately - highest possible priority. E.g. an emergency."; - default: return "?"; - } - } - public String getDisplay() { - switch (this) { - case ROUTINE: return "Routine"; - case URGENT: return "Urgent"; - case ASAP: return "ASAP"; - case STAT: return "STAT"; - default: return "?"; - } - } + public String getSystem() { + switch (this) { + case ROUTINE: + return "http://hl7.org/fhir/request-priority"; + case URGENT: + return "http://hl7.org/fhir/request-priority"; + case ASAP: + return "http://hl7.org/fhir/request-priority"; + case STAT: + return "http://hl7.org/fhir/request-priority"; + default: + return "?"; + } } + public String getDefinition() { + switch (this) { + case ROUTINE: + return "The request has normal priority."; + case URGENT: + return "The request should be actioned promptly - higher priority than routine."; + case ASAP: + return "The request should be actioned as soon as possible - higher priority than urgent."; + case STAT: + return "The request should be actioned immediately - highest possible priority. E.g. an emergency."; + default: + return "?"; + } + } + + public String getDisplay() { + switch (this) { + case ROUTINE: + return "Routine"; + case URGENT: + return "Urgent"; + case ASAP: + return "ASAP"; + case STAT: + return "STAT"; + default: + return "?"; + } + } + } + public static class MedicationRequestPriorityEnumFactory implements EnumFactory { public MedicationRequestPriority fromCode(String codeString) throws IllegalArgumentException { if (codeString == null || "".equals(codeString)) - if (codeString == null || "".equals(codeString)) - return null; - if ("routine".equals(codeString)) - return MedicationRequestPriority.ROUTINE; - if ("urgent".equals(codeString)) - return MedicationRequestPriority.URGENT; - if ("asap".equals(codeString)) - return MedicationRequestPriority.ASAP; - if ("stat".equals(codeString)) - return MedicationRequestPriority.STAT; - throw new IllegalArgumentException("Unknown MedicationRequestPriority code '"+codeString+"'"); - } - public Enumeration fromType(Base code) throws FHIRException { - if (code == null) - return null; - if (code.isEmpty()) - return new Enumeration(this); - String codeString = ((PrimitiveType) code).asStringValue(); - if (codeString == null || "".equals(codeString)) - return null; - if ("routine".equals(codeString)) - return new Enumeration(this, MedicationRequestPriority.ROUTINE); - if ("urgent".equals(codeString)) - return new Enumeration(this, MedicationRequestPriority.URGENT); - if ("asap".equals(codeString)) - return new Enumeration(this, MedicationRequestPriority.ASAP); - if ("stat".equals(codeString)) - return new Enumeration(this, MedicationRequestPriority.STAT); - throw new FHIRException("Unknown MedicationRequestPriority code '"+codeString+"'"); - } + if (codeString == null || "".equals(codeString)) + return null; + if ("routine".equals(codeString)) + return MedicationRequestPriority.ROUTINE; + if ("urgent".equals(codeString)) + return MedicationRequestPriority.URGENT; + if ("asap".equals(codeString)) + return MedicationRequestPriority.ASAP; + if ("stat".equals(codeString)) + return MedicationRequestPriority.STAT; + throw new IllegalArgumentException("Unknown MedicationRequestPriority code '" + codeString + "'"); + } + + public Enumeration fromType(Base code) throws FHIRException { + if (code == null) + return null; + if (code.isEmpty()) + return new Enumeration(this); + String codeString = ((PrimitiveType) code).asStringValue(); + if (codeString == null || "".equals(codeString)) + return null; + if ("routine".equals(codeString)) + return new Enumeration(this, MedicationRequestPriority.ROUTINE); + if ("urgent".equals(codeString)) + return new Enumeration(this, MedicationRequestPriority.URGENT); + if ("asap".equals(codeString)) + return new Enumeration(this, MedicationRequestPriority.ASAP); + if ("stat".equals(codeString)) + return new Enumeration(this, MedicationRequestPriority.STAT); + throw new FHIRException("Unknown MedicationRequestPriority code '" + codeString + "'"); + } + public String toCode(MedicationRequestPriority code) { if (code == MedicationRequestPriority.ROUTINE) return "routine"; @@ -562,330 +678,347 @@ public class MedicationRequest extends DomainResource { if (code == MedicationRequestPriority.STAT) return "stat"; return "?"; - } - public String toSystem(MedicationRequestPriority code) { - return code.getSystem(); - } } - @Block() - public static class MedicationRequestDispenseRequestComponent extends BackboneElement implements IBaseBackboneElement { - /** - * Indicates the quantity or duration for the first dispense of the medication. - */ - @Child(name = "initialFill", type = {}, order=1, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="First fill details", formalDefinition="Indicates the quantity or duration for the first dispense of the medication." ) - protected MedicationRequestDispenseRequestInitialFillComponent initialFill; + public String toSystem(MedicationRequestPriority code) { + return code.getSystem(); + } + } - /** - * The minimum period of time that must occur between dispenses of the medication. - */ - @Child(name = "dispenseInterval", type = {Duration.class}, order=2, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="Minimum period of time between dispenses", formalDefinition="The minimum period of time that must occur between dispenses of the medication." ) - protected Duration dispenseInterval; + @Block() + public static class MedicationRequestDispenseRequestComponent extends BackboneElement implements IBaseBackboneElement { + /** + * Indicates the quantity or duration for the first dispense of the medication. + */ + @Child(name = "initialFill", type = {}, order = 1, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "First fill details", formalDefinition = "Indicates the quantity or duration for the first dispense of the medication.") + protected MedicationRequestDispenseRequestInitialFillComponent initialFill; - /** - * This indicates the validity period of a prescription (stale dating the Prescription). - */ - @Child(name = "validityPeriod", type = {Period.class}, order=3, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="Time period supply is authorized for", formalDefinition="This indicates the validity period of a prescription (stale dating the Prescription)." ) - protected Period validityPeriod; + /** + * The minimum period of time that must occur between dispenses of the medication. + */ + @Child(name = "dispenseInterval", type = {Duration.class}, order = 2, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "Minimum period of time between dispenses", formalDefinition = "The minimum period of time that must occur between dispenses of the medication.") + protected Duration dispenseInterval; - /** - * An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. A prescriber may explicitly say that zero refills are permitted after the initial dispense. - */ - @Child(name = "numberOfRepeatsAllowed", type = {UnsignedIntType.class}, order=4, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="Number of refills authorized", formalDefinition="An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus \"3 repeats\", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. A prescriber may explicitly say that zero refills are permitted after the initial dispense." ) - protected UnsignedIntType numberOfRepeatsAllowed; + /** + * This indicates the validity period of a prescription (stale dating the Prescription). + */ + @Child(name = "validityPeriod", type = {Period.class}, order = 3, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "Time period supply is authorized for", formalDefinition = "This indicates the validity period of a prescription (stale dating the Prescription).") + protected Period validityPeriod; - /** - * The amount that is to be dispensed for one fill. - */ - @Child(name = "quantity", type = {Quantity.class}, order=5, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="Amount of medication to supply per dispense", formalDefinition="The amount that is to be dispensed for one fill." ) - protected Quantity quantity; + /** + * An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. A prescriber may explicitly say that zero refills are permitted after the initial dispense. + */ + @Child(name = "numberOfRepeatsAllowed", type = {UnsignedIntType.class}, order = 4, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "Number of refills authorized", formalDefinition = "An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus \"3 repeats\", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. A prescriber may explicitly say that zero refills are permitted after the initial dispense.") + protected UnsignedIntType numberOfRepeatsAllowed; - /** - * Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last. - */ - @Child(name = "expectedSupplyDuration", type = {Duration.class}, order=6, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="Number of days supply per dispense", formalDefinition="Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last." ) - protected Duration expectedSupplyDuration; + /** + * The amount that is to be dispensed for one fill. + */ + @Child(name = "quantity", type = {Quantity.class}, order = 5, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "Amount of medication to supply per dispense", formalDefinition = "The amount that is to be dispensed for one fill.") + protected Quantity quantity; - /** - * Indicates the intended dispensing Organization specified by the prescriber. - */ - @Child(name = "performer", type = {Organization.class}, order=7, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="Intended dispenser", formalDefinition="Indicates the intended dispensing Organization specified by the prescriber." ) - protected Reference performer; + /** + * Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last. + */ + @Child(name = "expectedSupplyDuration", type = {Duration.class}, order = 6, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "Number of days supply per dispense", formalDefinition = "Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.") + protected Duration expectedSupplyDuration; - /** - * The actual object that is the target of the reference (Indicates the intended dispensing Organization specified by the prescriber.) - */ - protected Organization performerTarget; + /** + * Indicates the intended dispensing Organization specified by the prescriber. + */ + @Child(name = "performer", type = {Organization.class}, order = 7, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "Intended dispenser", formalDefinition = "Indicates the intended dispensing Organization specified by the prescriber.") + protected Reference performer; - private static final long serialVersionUID = -1680129929L; + /** + * The actual object that is the target of the reference (Indicates the intended dispensing Organization specified by the prescriber.) + */ + protected Organization performerTarget; + + private static final long serialVersionUID = -1680129929L; /** * Constructor */ - public MedicationRequestDispenseRequestComponent() { - super(); + public MedicationRequestDispenseRequestComponent() { + super(); + } + + /** + * @return {@link #initialFill} (Indicates the quantity or duration for the first dispense of the medication.) + */ + public MedicationRequestDispenseRequestInitialFillComponent getInitialFill() { + if (this.initialFill == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.initialFill"); + else if (Configuration.doAutoCreate()) + this.initialFill = new MedicationRequestDispenseRequestInitialFillComponent(); // cc + return this.initialFill; + } + + public boolean hasInitialFill() { + return this.initialFill != null && !this.initialFill.isEmpty(); + } + + /** + * @param value {@link #initialFill} (Indicates the quantity or duration for the first dispense of the medication.) + */ + public MedicationRequestDispenseRequestComponent setInitialFill(MedicationRequestDispenseRequestInitialFillComponent value) { + this.initialFill = value; + return this; + } + + /** + * @return {@link #dispenseInterval} (The minimum period of time that must occur between dispenses of the medication.) + */ + public Duration getDispenseInterval() { + if (this.dispenseInterval == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.dispenseInterval"); + else if (Configuration.doAutoCreate()) + this.dispenseInterval = new Duration(); // cc + return this.dispenseInterval; + } + + public boolean hasDispenseInterval() { + return this.dispenseInterval != null && !this.dispenseInterval.isEmpty(); + } + + /** + * @param value {@link #dispenseInterval} (The minimum period of time that must occur between dispenses of the medication.) + */ + public MedicationRequestDispenseRequestComponent setDispenseInterval(Duration value) { + this.dispenseInterval = value; + return this; + } + + /** + * @return {@link #validityPeriod} (This indicates the validity period of a prescription (stale dating the Prescription).) + */ + public Period getValidityPeriod() { + if (this.validityPeriod == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.validityPeriod"); + else if (Configuration.doAutoCreate()) + this.validityPeriod = new Period(); // cc + return this.validityPeriod; + } + + public boolean hasValidityPeriod() { + return this.validityPeriod != null && !this.validityPeriod.isEmpty(); + } + + /** + * @param value {@link #validityPeriod} (This indicates the validity period of a prescription (stale dating the Prescription).) + */ + public MedicationRequestDispenseRequestComponent setValidityPeriod(Period value) { + this.validityPeriod = value; + return this; + } + + /** + * @return {@link #numberOfRepeatsAllowed} (An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. A prescriber may explicitly say that zero refills are permitted after the initial dispense.). This is the underlying object with id, value and extensions. The accessor "getNumberOfRepeatsAllowed" gives direct access to the value + */ + public UnsignedIntType getNumberOfRepeatsAllowedElement() { + if (this.numberOfRepeatsAllowed == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.numberOfRepeatsAllowed"); + else if (Configuration.doAutoCreate()) + this.numberOfRepeatsAllowed = new UnsignedIntType(); // bb + return this.numberOfRepeatsAllowed; + } + + public boolean hasNumberOfRepeatsAllowedElement() { + return this.numberOfRepeatsAllowed != null && !this.numberOfRepeatsAllowed.isEmpty(); + } + + public boolean hasNumberOfRepeatsAllowed() { + return this.numberOfRepeatsAllowed != null && !this.numberOfRepeatsAllowed.isEmpty(); + } + + /** + * @param value {@link #numberOfRepeatsAllowed} (An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. A prescriber may explicitly say that zero refills are permitted after the initial dispense.). This is the underlying object with id, value and extensions. The accessor "getNumberOfRepeatsAllowed" gives direct access to the value + */ + public MedicationRequestDispenseRequestComponent setNumberOfRepeatsAllowedElement(UnsignedIntType value) { + this.numberOfRepeatsAllowed = value; + return this; + } + + /** + * @return An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. A prescriber may explicitly say that zero refills are permitted after the initial dispense. + */ + public int getNumberOfRepeatsAllowed() { + return this.numberOfRepeatsAllowed == null || this.numberOfRepeatsAllowed.isEmpty() ? 0 : this.numberOfRepeatsAllowed.getValue(); + } + + /** + * @param value An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. A prescriber may explicitly say that zero refills are permitted after the initial dispense. + */ + public MedicationRequestDispenseRequestComponent setNumberOfRepeatsAllowed(int value) { + if (this.numberOfRepeatsAllowed == null) + this.numberOfRepeatsAllowed = new UnsignedIntType(); + this.numberOfRepeatsAllowed.setValue(value); + return this; + } + + /** + * @return {@link #quantity} (The amount that is to be dispensed for one fill.) + */ + public Quantity getQuantity() { + if (this.quantity == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.quantity"); + else if (Configuration.doAutoCreate()) + this.quantity = new Quantity(); // cc + return this.quantity; + } + + public boolean hasQuantity() { + return this.quantity != null && !this.quantity.isEmpty(); + } + + /** + * @param value {@link #quantity} (The amount that is to be dispensed for one fill.) + */ + public MedicationRequestDispenseRequestComponent setQuantity(Quantity value) { + this.quantity = value; + return this; + } + + /** + * @return {@link #expectedSupplyDuration} (Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.) + */ + public Duration getExpectedSupplyDuration() { + if (this.expectedSupplyDuration == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.expectedSupplyDuration"); + else if (Configuration.doAutoCreate()) + this.expectedSupplyDuration = new Duration(); // cc + return this.expectedSupplyDuration; + } + + public boolean hasExpectedSupplyDuration() { + return this.expectedSupplyDuration != null && !this.expectedSupplyDuration.isEmpty(); + } + + /** + * @param value {@link #expectedSupplyDuration} (Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.) + */ + public MedicationRequestDispenseRequestComponent setExpectedSupplyDuration(Duration value) { + this.expectedSupplyDuration = value; + return this; + } + + /** + * @return {@link #performer} (Indicates the intended dispensing Organization specified by the prescriber.) + */ + public Reference getPerformer() { + if (this.performer == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.performer"); + else if (Configuration.doAutoCreate()) + this.performer = new Reference(); // cc + return this.performer; + } + + public boolean hasPerformer() { + return this.performer != null && !this.performer.isEmpty(); + } + + /** + * @param value {@link #performer} (Indicates the intended dispensing Organization specified by the prescriber.) + */ + public MedicationRequestDispenseRequestComponent setPerformer(Reference value) { + this.performer = value; + return this; + } + + /** + * @return {@link #performer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Indicates the intended dispensing Organization specified by the prescriber.) + */ + public Organization getPerformerTarget() { + if (this.performerTarget == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.performer"); + else if (Configuration.doAutoCreate()) + this.performerTarget = new Organization(); // aa + return this.performerTarget; + } + + /** + * @param value {@link #performer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Indicates the intended dispensing Organization specified by the prescriber.) + */ + public MedicationRequestDispenseRequestComponent setPerformerTarget(Organization value) { + this.performerTarget = value; + return this; + } + + protected void listChildren(List children) { + super.listChildren(children); + children.add(new Property("initialFill", "", "Indicates the quantity or duration for the first dispense of the medication.", 0, 1, initialFill)); + children.add(new Property("dispenseInterval", "Duration", "The minimum period of time that must occur between dispenses of the medication.", 0, 1, dispenseInterval)); + children.add(new Property("validityPeriod", "Period", "This indicates the validity period of a prescription (stale dating the Prescription).", 0, 1, validityPeriod)); + children.add(new Property("numberOfRepeatsAllowed", "unsignedInt", "An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus \"3 repeats\", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. A prescriber may explicitly say that zero refills are permitted after the initial dispense.", 0, 1, numberOfRepeatsAllowed)); + children.add(new Property("quantity", "SimpleQuantity", "The amount that is to be dispensed for one fill.", 0, 1, quantity)); + children.add(new Property("expectedSupplyDuration", "Duration", "Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.", 0, 1, expectedSupplyDuration)); + children.add(new Property("performer", "Reference(Organization)", "Indicates the intended dispensing Organization specified by the prescriber.", 0, 1, performer)); + } + + @Override + public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { + switch (_hash) { + case 1232961255: /*initialFill*/ + return new Property("initialFill", "", "Indicates the quantity or duration for the first dispense of the medication.", 0, 1, initialFill); + case 757112130: /*dispenseInterval*/ + return new Property("dispenseInterval", "Duration", "The minimum period of time that must occur between dispenses of the medication.", 0, 1, dispenseInterval); + case -1434195053: /*validityPeriod*/ + return new Property("validityPeriod", "Period", "This indicates the validity period of a prescription (stale dating the Prescription).", 0, 1, validityPeriod); + case -239736976: /*numberOfRepeatsAllowed*/ + return new Property("numberOfRepeatsAllowed", "unsignedInt", "An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus \"3 repeats\", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. A prescriber may explicitly say that zero refills are permitted after the initial dispense.", 0, 1, numberOfRepeatsAllowed); + case -1285004149: /*quantity*/ + return new Property("quantity", "SimpleQuantity", "The amount that is to be dispensed for one fill.", 0, 1, quantity); + case -1910182789: /*expectedSupplyDuration*/ + return new Property("expectedSupplyDuration", "Duration", "Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.", 0, 1, expectedSupplyDuration); + case 481140686: /*performer*/ + return new Property("performer", "Reference(Organization)", "Indicates the intended dispensing Organization specified by the prescriber.", 0, 1, performer); + default: + return super.getNamedProperty(_hash, _name, _checkValid); } - /** - * @return {@link #initialFill} (Indicates the quantity or duration for the first dispense of the medication.) - */ - public MedicationRequestDispenseRequestInitialFillComponent getInitialFill() { - if (this.initialFill == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.initialFill"); - else if (Configuration.doAutoCreate()) - this.initialFill = new MedicationRequestDispenseRequestInitialFillComponent(); // cc - return this.initialFill; - } - - public boolean hasInitialFill() { - return this.initialFill != null && !this.initialFill.isEmpty(); - } - - /** - * @param value {@link #initialFill} (Indicates the quantity or duration for the first dispense of the medication.) - */ - public MedicationRequestDispenseRequestComponent setInitialFill(MedicationRequestDispenseRequestInitialFillComponent value) { - this.initialFill = value; - return this; - } - - /** - * @return {@link #dispenseInterval} (The minimum period of time that must occur between dispenses of the medication.) - */ - public Duration getDispenseInterval() { - if (this.dispenseInterval == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.dispenseInterval"); - else if (Configuration.doAutoCreate()) - this.dispenseInterval = new Duration(); // cc - return this.dispenseInterval; - } - - public boolean hasDispenseInterval() { - return this.dispenseInterval != null && !this.dispenseInterval.isEmpty(); - } - - /** - * @param value {@link #dispenseInterval} (The minimum period of time that must occur between dispenses of the medication.) - */ - public MedicationRequestDispenseRequestComponent setDispenseInterval(Duration value) { - this.dispenseInterval = value; - return this; - } - - /** - * @return {@link #validityPeriod} (This indicates the validity period of a prescription (stale dating the Prescription).) - */ - public Period getValidityPeriod() { - if (this.validityPeriod == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.validityPeriod"); - else if (Configuration.doAutoCreate()) - this.validityPeriod = new Period(); // cc - return this.validityPeriod; - } - - public boolean hasValidityPeriod() { - return this.validityPeriod != null && !this.validityPeriod.isEmpty(); - } - - /** - * @param value {@link #validityPeriod} (This indicates the validity period of a prescription (stale dating the Prescription).) - */ - public MedicationRequestDispenseRequestComponent setValidityPeriod(Period value) { - this.validityPeriod = value; - return this; - } - - /** - * @return {@link #numberOfRepeatsAllowed} (An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. A prescriber may explicitly say that zero refills are permitted after the initial dispense.). This is the underlying object with id, value and extensions. The accessor "getNumberOfRepeatsAllowed" gives direct access to the value - */ - public UnsignedIntType getNumberOfRepeatsAllowedElement() { - if (this.numberOfRepeatsAllowed == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.numberOfRepeatsAllowed"); - else if (Configuration.doAutoCreate()) - this.numberOfRepeatsAllowed = new UnsignedIntType(); // bb - return this.numberOfRepeatsAllowed; - } - - public boolean hasNumberOfRepeatsAllowedElement() { - return this.numberOfRepeatsAllowed != null && !this.numberOfRepeatsAllowed.isEmpty(); - } - - public boolean hasNumberOfRepeatsAllowed() { - return this.numberOfRepeatsAllowed != null && !this.numberOfRepeatsAllowed.isEmpty(); - } - - /** - * @param value {@link #numberOfRepeatsAllowed} (An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. A prescriber may explicitly say that zero refills are permitted after the initial dispense.). This is the underlying object with id, value and extensions. The accessor "getNumberOfRepeatsAllowed" gives direct access to the value - */ - public MedicationRequestDispenseRequestComponent setNumberOfRepeatsAllowedElement(UnsignedIntType value) { - this.numberOfRepeatsAllowed = value; - return this; - } - - /** - * @return An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. A prescriber may explicitly say that zero refills are permitted after the initial dispense. - */ - public int getNumberOfRepeatsAllowed() { - return this.numberOfRepeatsAllowed == null || this.numberOfRepeatsAllowed.isEmpty() ? 0 : this.numberOfRepeatsAllowed.getValue(); - } - - /** - * @param value An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus "3 repeats", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. A prescriber may explicitly say that zero refills are permitted after the initial dispense. - */ - public MedicationRequestDispenseRequestComponent setNumberOfRepeatsAllowed(int value) { - if (this.numberOfRepeatsAllowed == null) - this.numberOfRepeatsAllowed = new UnsignedIntType(); - this.numberOfRepeatsAllowed.setValue(value); - return this; - } - - /** - * @return {@link #quantity} (The amount that is to be dispensed for one fill.) - */ - public Quantity getQuantity() { - if (this.quantity == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.quantity"); - else if (Configuration.doAutoCreate()) - this.quantity = new Quantity(); // cc - return this.quantity; - } - - public boolean hasQuantity() { - return this.quantity != null && !this.quantity.isEmpty(); - } - - /** - * @param value {@link #quantity} (The amount that is to be dispensed for one fill.) - */ - public MedicationRequestDispenseRequestComponent setQuantity(Quantity value) { - this.quantity = value; - return this; - } - - /** - * @return {@link #expectedSupplyDuration} (Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.) - */ - public Duration getExpectedSupplyDuration() { - if (this.expectedSupplyDuration == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.expectedSupplyDuration"); - else if (Configuration.doAutoCreate()) - this.expectedSupplyDuration = new Duration(); // cc - return this.expectedSupplyDuration; - } - - public boolean hasExpectedSupplyDuration() { - return this.expectedSupplyDuration != null && !this.expectedSupplyDuration.isEmpty(); - } - - /** - * @param value {@link #expectedSupplyDuration} (Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.) - */ - public MedicationRequestDispenseRequestComponent setExpectedSupplyDuration(Duration value) { - this.expectedSupplyDuration = value; - return this; - } - - /** - * @return {@link #performer} (Indicates the intended dispensing Organization specified by the prescriber.) - */ - public Reference getPerformer() { - if (this.performer == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.performer"); - else if (Configuration.doAutoCreate()) - this.performer = new Reference(); // cc - return this.performer; - } - - public boolean hasPerformer() { - return this.performer != null && !this.performer.isEmpty(); - } - - /** - * @param value {@link #performer} (Indicates the intended dispensing Organization specified by the prescriber.) - */ - public MedicationRequestDispenseRequestComponent setPerformer(Reference value) { - this.performer = value; - return this; - } - - /** - * @return {@link #performer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (Indicates the intended dispensing Organization specified by the prescriber.) - */ - public Organization getPerformerTarget() { - if (this.performerTarget == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequestDispenseRequestComponent.performer"); - else if (Configuration.doAutoCreate()) - this.performerTarget = new Organization(); // aa - return this.performerTarget; - } - - /** - * @param value {@link #performer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (Indicates the intended dispensing Organization specified by the prescriber.) - */ - public MedicationRequestDispenseRequestComponent setPerformerTarget(Organization value) { - this.performerTarget = value; - return this; - } - - protected void listChildren(List children) { - super.listChildren(children); - children.add(new Property("initialFill", "", "Indicates the quantity or duration for the first dispense of the medication.", 0, 1, initialFill)); - children.add(new Property("dispenseInterval", "Duration", "The minimum period of time that must occur between dispenses of the medication.", 0, 1, dispenseInterval)); - children.add(new Property("validityPeriod", "Period", "This indicates the validity period of a prescription (stale dating the Prescription).", 0, 1, validityPeriod)); - children.add(new Property("numberOfRepeatsAllowed", "unsignedInt", "An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus \"3 repeats\", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. A prescriber may explicitly say that zero refills are permitted after the initial dispense.", 0, 1, numberOfRepeatsAllowed)); - children.add(new Property("quantity", "SimpleQuantity", "The amount that is to be dispensed for one fill.", 0, 1, quantity)); - children.add(new Property("expectedSupplyDuration", "Duration", "Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.", 0, 1, expectedSupplyDuration)); - children.add(new Property("performer", "Reference(Organization)", "Indicates the intended dispensing Organization specified by the prescriber.", 0, 1, performer)); - } - - @Override - public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { - switch (_hash) { - case 1232961255: /*initialFill*/ return new Property("initialFill", "", "Indicates the quantity or duration for the first dispense of the medication.", 0, 1, initialFill); - case 757112130: /*dispenseInterval*/ return new Property("dispenseInterval", "Duration", "The minimum period of time that must occur between dispenses of the medication.", 0, 1, dispenseInterval); - case -1434195053: /*validityPeriod*/ return new Property("validityPeriod", "Period", "This indicates the validity period of a prescription (stale dating the Prescription).", 0, 1, validityPeriod); - case -239736976: /*numberOfRepeatsAllowed*/ return new Property("numberOfRepeatsAllowed", "unsignedInt", "An integer indicating the number of times, in addition to the original dispense, (aka refills or repeats) that the patient can receive the prescribed medication. Usage Notes: This integer does not include the original order dispense. This means that if an order indicates dispense 30 tablets plus \"3 repeats\", then the order can be dispensed a total of 4 times and the patient can receive a total of 120 tablets. A prescriber may explicitly say that zero refills are permitted after the initial dispense.", 0, 1, numberOfRepeatsAllowed); - case -1285004149: /*quantity*/ return new Property("quantity", "SimpleQuantity", "The amount that is to be dispensed for one fill.", 0, 1, quantity); - case -1910182789: /*expectedSupplyDuration*/ return new Property("expectedSupplyDuration", "Duration", "Identifies the period time over which the supplied product is expected to be used, or the length of time the dispense is expected to last.", 0, 1, expectedSupplyDuration); - case 481140686: /*performer*/ return new Property("performer", "Reference(Organization)", "Indicates the intended dispensing Organization specified by the prescriber.", 0, 1, performer); - default: return super.getNamedProperty(_hash, _name, _checkValid); - } - - } - - @Override - public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { - switch (hash) { - case 1232961255: /*initialFill*/ return this.initialFill == null ? new Base[0] : new Base[] {this.initialFill}; // MedicationRequestDispenseRequestInitialFillComponent - case 757112130: /*dispenseInterval*/ return this.dispenseInterval == null ? new Base[0] : new Base[] {this.dispenseInterval}; // Duration - case -1434195053: /*validityPeriod*/ return this.validityPeriod == null ? new Base[0] : new Base[] {this.validityPeriod}; // Period - case -239736976: /*numberOfRepeatsAllowed*/ return this.numberOfRepeatsAllowed == null ? new Base[0] : new Base[] {this.numberOfRepeatsAllowed}; // UnsignedIntType - case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity - case -1910182789: /*expectedSupplyDuration*/ return this.expectedSupplyDuration == null ? new Base[0] : new Base[] {this.expectedSupplyDuration}; // Duration - case 481140686: /*performer*/ return this.performer == null ? new Base[0] : new Base[] {this.performer}; // Reference - default: return super.getProperty(hash, name, checkValid); - } + } + @Override + public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { + switch (hash) { + case 1232961255: /*initialFill*/ + return this.initialFill == null ? new Base[0] : new Base[]{this.initialFill}; // MedicationRequestDispenseRequestInitialFillComponent + case 757112130: /*dispenseInterval*/ + return this.dispenseInterval == null ? new Base[0] : new Base[]{this.dispenseInterval}; // Duration + case -1434195053: /*validityPeriod*/ + return this.validityPeriod == null ? new Base[0] : new Base[]{this.validityPeriod}; // Period + case -239736976: /*numberOfRepeatsAllowed*/ + return this.numberOfRepeatsAllowed == null ? new Base[0] : new Base[]{this.numberOfRepeatsAllowed}; // UnsignedIntType + case -1285004149: /*quantity*/ + return this.quantity == null ? new Base[0] : new Base[]{this.quantity}; // Quantity + case -1910182789: /*expectedSupplyDuration*/ + return this.expectedSupplyDuration == null ? new Base[0] : new Base[]{this.expectedSupplyDuration}; // Duration + case 481140686: /*performer*/ + return this.performer == null ? new Base[0] : new Base[]{this.performer}; // Reference + default: + return super.getProperty(hash, name, checkValid); } - @Override - public Base setProperty(int hash, String name, Base value) throws FHIRException { - switch (hash) { + } + + @Override + public Base setProperty(int hash, String name, Base value) throws FHIRException { + switch (hash) { case 1232961255: // initialFill this.initialFill = (MedicationRequestDispenseRequestInitialFillComponent) value; // MedicationRequestDispenseRequestInitialFillComponent return value; @@ -907,3067 +1040,3222 @@ public class MedicationRequest extends DomainResource { case 481140686: // performer this.performer = castToReference(value); // Reference return value; - default: return super.setProperty(hash, name, value); - } - + default: + return super.setProperty(hash, name, value); } - @Override - public Base setProperty(String name, Base value) throws FHIRException { - if (name.equals("initialFill")) { - this.initialFill = (MedicationRequestDispenseRequestInitialFillComponent) value; // MedicationRequestDispenseRequestInitialFillComponent - } else if (name.equals("dispenseInterval")) { - this.dispenseInterval = castToDuration(value); // Duration - } else if (name.equals("validityPeriod")) { - this.validityPeriod = castToPeriod(value); // Period - } else if (name.equals("numberOfRepeatsAllowed")) { - this.numberOfRepeatsAllowed = castToUnsignedInt(value); // UnsignedIntType - } else if (name.equals("quantity")) { - this.quantity = castToQuantity(value); // Quantity - } else if (name.equals("expectedSupplyDuration")) { - this.expectedSupplyDuration = castToDuration(value); // Duration - } else if (name.equals("performer")) { - this.performer = castToReference(value); // Reference - } else - return super.setProperty(name, value); - return value; + } + + @Override + public Base setProperty(String name, Base value) throws FHIRException { + if (name.equals("initialFill")) { + this.initialFill = (MedicationRequestDispenseRequestInitialFillComponent) value; // MedicationRequestDispenseRequestInitialFillComponent + } else if (name.equals("dispenseInterval")) { + this.dispenseInterval = castToDuration(value); // Duration + } else if (name.equals("validityPeriod")) { + this.validityPeriod = castToPeriod(value); // Period + } else if (name.equals("numberOfRepeatsAllowed")) { + this.numberOfRepeatsAllowed = castToUnsignedInt(value); // UnsignedIntType + } else if (name.equals("quantity")) { + this.quantity = castToQuantity(value); // Quantity + } else if (name.equals("expectedSupplyDuration")) { + this.expectedSupplyDuration = castToDuration(value); // Duration + } else if (name.equals("performer")) { + this.performer = castToReference(value); // Reference + } else + return super.setProperty(name, value); + return value; + } + + @Override + public Base makeProperty(int hash, String name) throws FHIRException { + switch (hash) { + case 1232961255: + return getInitialFill(); + case 757112130: + return getDispenseInterval(); + case -1434195053: + return getValidityPeriod(); + case -239736976: + return getNumberOfRepeatsAllowedElement(); + case -1285004149: + return getQuantity(); + case -1910182789: + return getExpectedSupplyDuration(); + case 481140686: + return getPerformer(); + default: + return super.makeProperty(hash, name); } - @Override - public Base makeProperty(int hash, String name) throws FHIRException { - switch (hash) { - case 1232961255: return getInitialFill(); - case 757112130: return getDispenseInterval(); - case -1434195053: return getValidityPeriod(); - case -239736976: return getNumberOfRepeatsAllowedElement(); - case -1285004149: return getQuantity(); - case -1910182789: return getExpectedSupplyDuration(); - case 481140686: return getPerformer(); - default: return super.makeProperty(hash, name); - } + } + @Override + public String[] getTypesForProperty(int hash, String name) throws FHIRException { + switch (hash) { + case 1232961255: /*initialFill*/ + return new String[]{}; + case 757112130: /*dispenseInterval*/ + return new String[]{"Duration"}; + case -1434195053: /*validityPeriod*/ + return new String[]{"Period"}; + case -239736976: /*numberOfRepeatsAllowed*/ + return new String[]{"unsignedInt"}; + case -1285004149: /*quantity*/ + return new String[]{"SimpleQuantity"}; + case -1910182789: /*expectedSupplyDuration*/ + return new String[]{"Duration"}; + case 481140686: /*performer*/ + return new String[]{"Reference"}; + default: + return super.getTypesForProperty(hash, name); } - @Override - public String[] getTypesForProperty(int hash, String name) throws FHIRException { - switch (hash) { - case 1232961255: /*initialFill*/ return new String[] {}; - case 757112130: /*dispenseInterval*/ return new String[] {"Duration"}; - case -1434195053: /*validityPeriod*/ return new String[] {"Period"}; - case -239736976: /*numberOfRepeatsAllowed*/ return new String[] {"unsignedInt"}; - case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"}; - case -1910182789: /*expectedSupplyDuration*/ return new String[] {"Duration"}; - case 481140686: /*performer*/ return new String[] {"Reference"}; - default: return super.getTypesForProperty(hash, name); - } + } - } + @Override + public Base addChild(String name) throws FHIRException { + if (name.equals("initialFill")) { + this.initialFill = new MedicationRequestDispenseRequestInitialFillComponent(); + return this.initialFill; + } else if (name.equals("dispenseInterval")) { + this.dispenseInterval = new Duration(); + return this.dispenseInterval; + } else if (name.equals("validityPeriod")) { + this.validityPeriod = new Period(); + return this.validityPeriod; + } else if (name.equals("numberOfRepeatsAllowed")) { + throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.numberOfRepeatsAllowed"); + } else if (name.equals("quantity")) { + this.quantity = new Quantity(); + return this.quantity; + } else if (name.equals("expectedSupplyDuration")) { + this.expectedSupplyDuration = new Duration(); + return this.expectedSupplyDuration; + } else if (name.equals("performer")) { + this.performer = new Reference(); + return this.performer; + } else + return super.addChild(name); + } - @Override - public Base addChild(String name) throws FHIRException { - if (name.equals("initialFill")) { - this.initialFill = new MedicationRequestDispenseRequestInitialFillComponent(); - return this.initialFill; - } - else if (name.equals("dispenseInterval")) { - this.dispenseInterval = new Duration(); - return this.dispenseInterval; - } - else if (name.equals("validityPeriod")) { - this.validityPeriod = new Period(); - return this.validityPeriod; - } - else if (name.equals("numberOfRepeatsAllowed")) { - throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.numberOfRepeatsAllowed"); - } - else if (name.equals("quantity")) { - this.quantity = new Quantity(); - return this.quantity; - } - else if (name.equals("expectedSupplyDuration")) { - this.expectedSupplyDuration = new Duration(); - return this.expectedSupplyDuration; - } - else if (name.equals("performer")) { - this.performer = new Reference(); - return this.performer; - } - else - return super.addChild(name); - } + public MedicationRequestDispenseRequestComponent copy() { + MedicationRequestDispenseRequestComponent dst = new MedicationRequestDispenseRequestComponent(); + copyValues(dst); + dst.initialFill = initialFill == null ? null : initialFill.copy(); + dst.dispenseInterval = dispenseInterval == null ? null : dispenseInterval.copy(); + dst.validityPeriod = validityPeriod == null ? null : validityPeriod.copy(); + dst.numberOfRepeatsAllowed = numberOfRepeatsAllowed == null ? null : numberOfRepeatsAllowed.copy(); + dst.quantity = quantity == null ? null : quantity.copy(); + dst.expectedSupplyDuration = expectedSupplyDuration == null ? null : expectedSupplyDuration.copy(); + dst.performer = performer == null ? null : performer.copy(); + return dst; + } - public MedicationRequestDispenseRequestComponent copy() { - MedicationRequestDispenseRequestComponent dst = new MedicationRequestDispenseRequestComponent(); - copyValues(dst); - dst.initialFill = initialFill == null ? null : initialFill.copy(); - dst.dispenseInterval = dispenseInterval == null ? null : dispenseInterval.copy(); - dst.validityPeriod = validityPeriod == null ? null : validityPeriod.copy(); - dst.numberOfRepeatsAllowed = numberOfRepeatsAllowed == null ? null : numberOfRepeatsAllowed.copy(); - dst.quantity = quantity == null ? null : quantity.copy(); - dst.expectedSupplyDuration = expectedSupplyDuration == null ? null : expectedSupplyDuration.copy(); - dst.performer = performer == null ? null : performer.copy(); - return dst; - } + @Override + public boolean equalsDeep(Base other_) { + if (!super.equalsDeep(other_)) + return false; + if (!(other_ instanceof MedicationRequestDispenseRequestComponent)) + return false; + MedicationRequestDispenseRequestComponent o = (MedicationRequestDispenseRequestComponent) other_; + return compareDeep(initialFill, o.initialFill, true) && compareDeep(dispenseInterval, o.dispenseInterval, true) + && compareDeep(validityPeriod, o.validityPeriod, true) && compareDeep(numberOfRepeatsAllowed, o.numberOfRepeatsAllowed, true) + && compareDeep(quantity, o.quantity, true) && compareDeep(expectedSupplyDuration, o.expectedSupplyDuration, true) + && compareDeep(performer, o.performer, true); + } - @Override - public boolean equalsDeep(Base other_) { - if (!super.equalsDeep(other_)) - return false; - if (!(other_ instanceof MedicationRequestDispenseRequestComponent)) - return false; - MedicationRequestDispenseRequestComponent o = (MedicationRequestDispenseRequestComponent) other_; - return compareDeep(initialFill, o.initialFill, true) && compareDeep(dispenseInterval, o.dispenseInterval, true) - && compareDeep(validityPeriod, o.validityPeriod, true) && compareDeep(numberOfRepeatsAllowed, o.numberOfRepeatsAllowed, true) - && compareDeep(quantity, o.quantity, true) && compareDeep(expectedSupplyDuration, o.expectedSupplyDuration, true) - && compareDeep(performer, o.performer, true); - } + @Override + public boolean equalsShallow(Base other_) { + if (!super.equalsShallow(other_)) + return false; + if (!(other_ instanceof MedicationRequestDispenseRequestComponent)) + return false; + MedicationRequestDispenseRequestComponent o = (MedicationRequestDispenseRequestComponent) other_; + return compareValues(numberOfRepeatsAllowed, o.numberOfRepeatsAllowed, true); + } - @Override - public boolean equalsShallow(Base other_) { - if (!super.equalsShallow(other_)) - return false; - if (!(other_ instanceof MedicationRequestDispenseRequestComponent)) - return false; - MedicationRequestDispenseRequestComponent o = (MedicationRequestDispenseRequestComponent) other_; - return compareValues(numberOfRepeatsAllowed, o.numberOfRepeatsAllowed, true); - } + public boolean isEmpty() { + return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(initialFill, dispenseInterval + , validityPeriod, numberOfRepeatsAllowed, quantity, expectedSupplyDuration, performer + ); + } - public boolean isEmpty() { - return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(initialFill, dispenseInterval - , validityPeriod, numberOfRepeatsAllowed, quantity, expectedSupplyDuration, performer - ); - } + public String fhirType() { + return "MedicationRequest.dispenseRequest"; - public String fhirType() { - return "MedicationRequest.dispenseRequest"; + } } - } + @Block() + public static class MedicationRequestDispenseRequestInitialFillComponent extends BackboneElement implements IBaseBackboneElement { + /** + * The amount or quantity to provide as part of the first dispense. + */ + @Child(name = "quantity", type = {Quantity.class}, order = 1, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "First fill quantity", formalDefinition = "The amount or quantity to provide as part of the first dispense.") + protected Quantity quantity; - @Block() - public static class MedicationRequestDispenseRequestInitialFillComponent extends BackboneElement implements IBaseBackboneElement { - /** - * The amount or quantity to provide as part of the first dispense. - */ - @Child(name = "quantity", type = {Quantity.class}, order=1, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="First fill quantity", formalDefinition="The amount or quantity to provide as part of the first dispense." ) - protected Quantity quantity; + /** + * The length of time that the first dispense is expected to last. + */ + @Child(name = "duration", type = {Duration.class}, order = 2, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "First fill duration", formalDefinition = "The length of time that the first dispense is expected to last.") + protected Duration duration; - /** - * The length of time that the first dispense is expected to last. - */ - @Child(name = "duration", type = {Duration.class}, order=2, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="First fill duration", formalDefinition="The length of time that the first dispense is expected to last." ) - protected Duration duration; - - private static final long serialVersionUID = 1223227956L; + private static final long serialVersionUID = 1223227956L; /** * Constructor */ - public MedicationRequestDispenseRequestInitialFillComponent() { - super(); + public MedicationRequestDispenseRequestInitialFillComponent() { + super(); + } + + /** + * @return {@link #quantity} (The amount or quantity to provide as part of the first dispense.) + */ + public Quantity getQuantity() { + if (this.quantity == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequestDispenseRequestInitialFillComponent.quantity"); + else if (Configuration.doAutoCreate()) + this.quantity = new Quantity(); // cc + return this.quantity; + } + + public boolean hasQuantity() { + return this.quantity != null && !this.quantity.isEmpty(); + } + + /** + * @param value {@link #quantity} (The amount or quantity to provide as part of the first dispense.) + */ + public MedicationRequestDispenseRequestInitialFillComponent setQuantity(Quantity value) { + this.quantity = value; + return this; + } + + /** + * @return {@link #duration} (The length of time that the first dispense is expected to last.) + */ + public Duration getDuration() { + if (this.duration == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequestDispenseRequestInitialFillComponent.duration"); + else if (Configuration.doAutoCreate()) + this.duration = new Duration(); // cc + return this.duration; + } + + public boolean hasDuration() { + return this.duration != null && !this.duration.isEmpty(); + } + + /** + * @param value {@link #duration} (The length of time that the first dispense is expected to last.) + */ + public MedicationRequestDispenseRequestInitialFillComponent setDuration(Duration value) { + this.duration = value; + return this; + } + + protected void listChildren(List children) { + super.listChildren(children); + children.add(new Property("quantity", "SimpleQuantity", "The amount or quantity to provide as part of the first dispense.", 0, 1, quantity)); + children.add(new Property("duration", "Duration", "The length of time that the first dispense is expected to last.", 0, 1, duration)); + } + + @Override + public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { + switch (_hash) { + case -1285004149: /*quantity*/ + return new Property("quantity", "SimpleQuantity", "The amount or quantity to provide as part of the first dispense.", 0, 1, quantity); + case -1992012396: /*duration*/ + return new Property("duration", "Duration", "The length of time that the first dispense is expected to last.", 0, 1, duration); + default: + return super.getNamedProperty(_hash, _name, _checkValid); } - /** - * @return {@link #quantity} (The amount or quantity to provide as part of the first dispense.) - */ - public Quantity getQuantity() { - if (this.quantity == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequestDispenseRequestInitialFillComponent.quantity"); - else if (Configuration.doAutoCreate()) - this.quantity = new Quantity(); // cc - return this.quantity; - } - - public boolean hasQuantity() { - return this.quantity != null && !this.quantity.isEmpty(); - } - - /** - * @param value {@link #quantity} (The amount or quantity to provide as part of the first dispense.) - */ - public MedicationRequestDispenseRequestInitialFillComponent setQuantity(Quantity value) { - this.quantity = value; - return this; - } - - /** - * @return {@link #duration} (The length of time that the first dispense is expected to last.) - */ - public Duration getDuration() { - if (this.duration == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequestDispenseRequestInitialFillComponent.duration"); - else if (Configuration.doAutoCreate()) - this.duration = new Duration(); // cc - return this.duration; - } - - public boolean hasDuration() { - return this.duration != null && !this.duration.isEmpty(); - } - - /** - * @param value {@link #duration} (The length of time that the first dispense is expected to last.) - */ - public MedicationRequestDispenseRequestInitialFillComponent setDuration(Duration value) { - this.duration = value; - return this; - } - - protected void listChildren(List children) { - super.listChildren(children); - children.add(new Property("quantity", "SimpleQuantity", "The amount or quantity to provide as part of the first dispense.", 0, 1, quantity)); - children.add(new Property("duration", "Duration", "The length of time that the first dispense is expected to last.", 0, 1, duration)); - } - - @Override - public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { - switch (_hash) { - case -1285004149: /*quantity*/ return new Property("quantity", "SimpleQuantity", "The amount or quantity to provide as part of the first dispense.", 0, 1, quantity); - case -1992012396: /*duration*/ return new Property("duration", "Duration", "The length of time that the first dispense is expected to last.", 0, 1, duration); - default: return super.getNamedProperty(_hash, _name, _checkValid); - } - - } - - @Override - public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { - switch (hash) { - case -1285004149: /*quantity*/ return this.quantity == null ? new Base[0] : new Base[] {this.quantity}; // Quantity - case -1992012396: /*duration*/ return this.duration == null ? new Base[0] : new Base[] {this.duration}; // Duration - default: return super.getProperty(hash, name, checkValid); - } + } + @Override + public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { + switch (hash) { + case -1285004149: /*quantity*/ + return this.quantity == null ? new Base[0] : new Base[]{this.quantity}; // Quantity + case -1992012396: /*duration*/ + return this.duration == null ? new Base[0] : new Base[]{this.duration}; // Duration + default: + return super.getProperty(hash, name, checkValid); } - @Override - public Base setProperty(int hash, String name, Base value) throws FHIRException { - switch (hash) { + } + + @Override + public Base setProperty(int hash, String name, Base value) throws FHIRException { + switch (hash) { case -1285004149: // quantity this.quantity = castToQuantity(value); // Quantity return value; case -1992012396: // duration this.duration = castToDuration(value); // Duration return value; - default: return super.setProperty(hash, name, value); - } - + default: + return super.setProperty(hash, name, value); } - @Override - public Base setProperty(String name, Base value) throws FHIRException { - if (name.equals("quantity")) { - this.quantity = castToQuantity(value); // Quantity - } else if (name.equals("duration")) { - this.duration = castToDuration(value); // Duration - } else - return super.setProperty(name, value); - return value; + } + + @Override + public Base setProperty(String name, Base value) throws FHIRException { + if (name.equals("quantity")) { + this.quantity = castToQuantity(value); // Quantity + } else if (name.equals("duration")) { + this.duration = castToDuration(value); // Duration + } else + return super.setProperty(name, value); + return value; + } + + @Override + public Base makeProperty(int hash, String name) throws FHIRException { + switch (hash) { + case -1285004149: + return getQuantity(); + case -1992012396: + return getDuration(); + default: + return super.makeProperty(hash, name); } - @Override - public Base makeProperty(int hash, String name) throws FHIRException { - switch (hash) { - case -1285004149: return getQuantity(); - case -1992012396: return getDuration(); - default: return super.makeProperty(hash, name); - } + } + @Override + public String[] getTypesForProperty(int hash, String name) throws FHIRException { + switch (hash) { + case -1285004149: /*quantity*/ + return new String[]{"SimpleQuantity"}; + case -1992012396: /*duration*/ + return new String[]{"Duration"}; + default: + return super.getTypesForProperty(hash, name); } - @Override - public String[] getTypesForProperty(int hash, String name) throws FHIRException { - switch (hash) { - case -1285004149: /*quantity*/ return new String[] {"SimpleQuantity"}; - case -1992012396: /*duration*/ return new String[] {"Duration"}; - default: return super.getTypesForProperty(hash, name); - } + } - } + @Override + public Base addChild(String name) throws FHIRException { + if (name.equals("quantity")) { + this.quantity = new Quantity(); + return this.quantity; + } else if (name.equals("duration")) { + this.duration = new Duration(); + return this.duration; + } else + return super.addChild(name); + } - @Override - public Base addChild(String name) throws FHIRException { - if (name.equals("quantity")) { - this.quantity = new Quantity(); - return this.quantity; - } - else if (name.equals("duration")) { - this.duration = new Duration(); - return this.duration; - } - else - return super.addChild(name); - } + public MedicationRequestDispenseRequestInitialFillComponent copy() { + MedicationRequestDispenseRequestInitialFillComponent dst = new MedicationRequestDispenseRequestInitialFillComponent(); + copyValues(dst); + dst.quantity = quantity == null ? null : quantity.copy(); + dst.duration = duration == null ? null : duration.copy(); + return dst; + } - public MedicationRequestDispenseRequestInitialFillComponent copy() { - MedicationRequestDispenseRequestInitialFillComponent dst = new MedicationRequestDispenseRequestInitialFillComponent(); - copyValues(dst); - dst.quantity = quantity == null ? null : quantity.copy(); - dst.duration = duration == null ? null : duration.copy(); - return dst; - } + @Override + public boolean equalsDeep(Base other_) { + if (!super.equalsDeep(other_)) + return false; + if (!(other_ instanceof MedicationRequestDispenseRequestInitialFillComponent)) + return false; + MedicationRequestDispenseRequestInitialFillComponent o = (MedicationRequestDispenseRequestInitialFillComponent) other_; + return compareDeep(quantity, o.quantity, true) && compareDeep(duration, o.duration, true); + } - @Override - public boolean equalsDeep(Base other_) { - if (!super.equalsDeep(other_)) - return false; - if (!(other_ instanceof MedicationRequestDispenseRequestInitialFillComponent)) - return false; - MedicationRequestDispenseRequestInitialFillComponent o = (MedicationRequestDispenseRequestInitialFillComponent) other_; - return compareDeep(quantity, o.quantity, true) && compareDeep(duration, o.duration, true); - } + @Override + public boolean equalsShallow(Base other_) { + if (!super.equalsShallow(other_)) + return false; + if (!(other_ instanceof MedicationRequestDispenseRequestInitialFillComponent)) + return false; + MedicationRequestDispenseRequestInitialFillComponent o = (MedicationRequestDispenseRequestInitialFillComponent) other_; + return true; + } - @Override - public boolean equalsShallow(Base other_) { - if (!super.equalsShallow(other_)) - return false; - if (!(other_ instanceof MedicationRequestDispenseRequestInitialFillComponent)) - return false; - MedicationRequestDispenseRequestInitialFillComponent o = (MedicationRequestDispenseRequestInitialFillComponent) other_; - return true; - } + public boolean isEmpty() { + return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(quantity, duration); + } - public boolean isEmpty() { - return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(quantity, duration); - } + public String fhirType() { + return "MedicationRequest.dispenseRequest.initialFill"; - public String fhirType() { - return "MedicationRequest.dispenseRequest.initialFill"; + } } - } + @Block() + public static class MedicationRequestSubstitutionComponent extends BackboneElement implements IBaseBackboneElement { + /** + * True if the prescriber allows a different drug to be dispensed from what was prescribed. + */ + @Child(name = "allowed", type = {BooleanType.class, CodeableConcept.class}, order = 1, min = 1, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "Whether substitution is allowed or not", formalDefinition = "True if the prescriber allows a different drug to be dispensed from what was prescribed.") + @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-ActSubstanceAdminSubstitutionCode") + protected Type allowed; - @Block() - public static class MedicationRequestSubstitutionComponent extends BackboneElement implements IBaseBackboneElement { - /** - * True if the prescriber allows a different drug to be dispensed from what was prescribed. - */ - @Child(name = "allowed", type = {BooleanType.class, CodeableConcept.class}, order=1, min=1, max=1, modifier=false, summary=false) - @Description(shortDefinition="Whether substitution is allowed or not", formalDefinition="True if the prescriber allows a different drug to be dispensed from what was prescribed." ) - @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-ActSubstanceAdminSubstitutionCode") - protected Type allowed; + /** + * Indicates the reason for the substitution, or why substitution must or must not be performed. + */ + @Child(name = "reason", type = {CodeableConcept.class}, order = 2, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "Why should (not) substitution be made", formalDefinition = "Indicates the reason for the substitution, or why substitution must or must not be performed.") + @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://terminology.hl7.org/ValueSet/v3-SubstanceAdminSubstitutionReason") + protected CodeableConcept reason; - /** - * Indicates the reason for the substitution, or why substitution must or must not be performed. - */ - @Child(name = "reason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="Why should (not) substitution be made", formalDefinition="Indicates the reason for the substitution, or why substitution must or must not be performed." ) - @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://terminology.hl7.org/ValueSet/v3-SubstanceAdminSubstitutionReason") - protected CodeableConcept reason; - - private static final long serialVersionUID = 547265407L; + private static final long serialVersionUID = 547265407L; /** * Constructor */ - public MedicationRequestSubstitutionComponent() { - super(); - } + public MedicationRequestSubstitutionComponent() { + super(); + } /** * Constructor */ - public MedicationRequestSubstitutionComponent(Type allowed) { - super(); - this.allowed = allowed; + public MedicationRequestSubstitutionComponent(Type allowed) { + super(); + this.allowed = allowed; + } + + /** + * @return {@link #allowed} (True if the prescriber allows a different drug to be dispensed from what was prescribed.) + */ + public Type getAllowed() { + return this.allowed; + } + + /** + * @return {@link #allowed} (True if the prescriber allows a different drug to be dispensed from what was prescribed.) + */ + public BooleanType getAllowedBooleanType() throws FHIRException { + if (this.allowed == null) + this.allowed = new BooleanType(); + if (!(this.allowed instanceof BooleanType)) + throw new FHIRException("Type mismatch: the type BooleanType was expected, but " + this.allowed.getClass().getName() + " was encountered"); + return (BooleanType) this.allowed; + } + + public boolean hasAllowedBooleanType() { + return this != null && this.allowed instanceof BooleanType; + } + + /** + * @return {@link #allowed} (True if the prescriber allows a different drug to be dispensed from what was prescribed.) + */ + public CodeableConcept getAllowedCodeableConcept() throws FHIRException { + if (this.allowed == null) + this.allowed = new CodeableConcept(); + if (!(this.allowed instanceof CodeableConcept)) + throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but " + this.allowed.getClass().getName() + " was encountered"); + return (CodeableConcept) this.allowed; + } + + public boolean hasAllowedCodeableConcept() { + return this != null && this.allowed instanceof CodeableConcept; + } + + public boolean hasAllowed() { + return this.allowed != null && !this.allowed.isEmpty(); + } + + /** + * @param value {@link #allowed} (True if the prescriber allows a different drug to be dispensed from what was prescribed.) + */ + public MedicationRequestSubstitutionComponent setAllowed(Type value) { + if (value != null && !(value instanceof BooleanType || value instanceof CodeableConcept)) + throw new Error("Not the right type for MedicationRequest.substitution.allowed[x]: " + value.fhirType()); + this.allowed = value; + return this; + } + + /** + * @return {@link #reason} (Indicates the reason for the substitution, or why substitution must or must not be performed.) + */ + public CodeableConcept getReason() { + if (this.reason == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequestSubstitutionComponent.reason"); + else if (Configuration.doAutoCreate()) + this.reason = new CodeableConcept(); // cc + return this.reason; + } + + public boolean hasReason() { + return this.reason != null && !this.reason.isEmpty(); + } + + /** + * @param value {@link #reason} (Indicates the reason for the substitution, or why substitution must or must not be performed.) + */ + public MedicationRequestSubstitutionComponent setReason(CodeableConcept value) { + this.reason = value; + return this; + } + + protected void listChildren(List children) { + super.listChildren(children); + children.add(new Property("allowed[x]", "boolean|CodeableConcept", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed)); + children.add(new Property("reason", "CodeableConcept", "Indicates the reason for the substitution, or why substitution must or must not be performed.", 0, 1, reason)); + } + + @Override + public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { + switch (_hash) { + case -1336663592: /*allowed[x]*/ + return new Property("allowed[x]", "boolean|CodeableConcept", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed); + case -911343192: /*allowed*/ + return new Property("allowed[x]", "boolean|CodeableConcept", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed); + case 177755488: /*allowedBoolean*/ + return new Property("allowed[x]", "boolean|CodeableConcept", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed); + case 963125465: /*allowedCodeableConcept*/ + return new Property("allowed[x]", "boolean|CodeableConcept", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed); + case -934964668: /*reason*/ + return new Property("reason", "CodeableConcept", "Indicates the reason for the substitution, or why substitution must or must not be performed.", 0, 1, reason); + default: + return super.getNamedProperty(_hash, _name, _checkValid); } - /** - * @return {@link #allowed} (True if the prescriber allows a different drug to be dispensed from what was prescribed.) - */ - public Type getAllowed() { - return this.allowed; - } - - /** - * @return {@link #allowed} (True if the prescriber allows a different drug to be dispensed from what was prescribed.) - */ - public BooleanType getAllowedBooleanType() throws FHIRException { - if (this.allowed == null) - this.allowed = new BooleanType(); - if (!(this.allowed instanceof BooleanType)) - throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.allowed.getClass().getName()+" was encountered"); - return (BooleanType) this.allowed; - } - - public boolean hasAllowedBooleanType() { - return this != null && this.allowed instanceof BooleanType; - } - - /** - * @return {@link #allowed} (True if the prescriber allows a different drug to be dispensed from what was prescribed.) - */ - public CodeableConcept getAllowedCodeableConcept() throws FHIRException { - if (this.allowed == null) - this.allowed = new CodeableConcept(); - if (!(this.allowed instanceof CodeableConcept)) - throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.allowed.getClass().getName()+" was encountered"); - return (CodeableConcept) this.allowed; - } - - public boolean hasAllowedCodeableConcept() { - return this != null && this.allowed instanceof CodeableConcept; - } - - public boolean hasAllowed() { - return this.allowed != null && !this.allowed.isEmpty(); - } - - /** - * @param value {@link #allowed} (True if the prescriber allows a different drug to be dispensed from what was prescribed.) - */ - public MedicationRequestSubstitutionComponent setAllowed(Type value) { - if (value != null && !(value instanceof BooleanType || value instanceof CodeableConcept)) - throw new Error("Not the right type for MedicationRequest.substitution.allowed[x]: "+value.fhirType()); - this.allowed = value; - return this; - } - - /** - * @return {@link #reason} (Indicates the reason for the substitution, or why substitution must or must not be performed.) - */ - public CodeableConcept getReason() { - if (this.reason == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequestSubstitutionComponent.reason"); - else if (Configuration.doAutoCreate()) - this.reason = new CodeableConcept(); // cc - return this.reason; - } - - public boolean hasReason() { - return this.reason != null && !this.reason.isEmpty(); - } - - /** - * @param value {@link #reason} (Indicates the reason for the substitution, or why substitution must or must not be performed.) - */ - public MedicationRequestSubstitutionComponent setReason(CodeableConcept value) { - this.reason = value; - return this; - } - - protected void listChildren(List children) { - super.listChildren(children); - children.add(new Property("allowed[x]", "boolean|CodeableConcept", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed)); - children.add(new Property("reason", "CodeableConcept", "Indicates the reason for the substitution, or why substitution must or must not be performed.", 0, 1, reason)); - } - - @Override - public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { - switch (_hash) { - case -1336663592: /*allowed[x]*/ return new Property("allowed[x]", "boolean|CodeableConcept", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed); - case -911343192: /*allowed*/ return new Property("allowed[x]", "boolean|CodeableConcept", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed); - case 177755488: /*allowedBoolean*/ return new Property("allowed[x]", "boolean|CodeableConcept", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed); - case 963125465: /*allowedCodeableConcept*/ return new Property("allowed[x]", "boolean|CodeableConcept", "True if the prescriber allows a different drug to be dispensed from what was prescribed.", 0, 1, allowed); - case -934964668: /*reason*/ return new Property("reason", "CodeableConcept", "Indicates the reason for the substitution, or why substitution must or must not be performed.", 0, 1, reason); - default: return super.getNamedProperty(_hash, _name, _checkValid); - } - - } - - @Override - public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { - switch (hash) { - case -911343192: /*allowed*/ return this.allowed == null ? new Base[0] : new Base[] {this.allowed}; // Type - case -934964668: /*reason*/ return this.reason == null ? new Base[0] : new Base[] {this.reason}; // CodeableConcept - default: return super.getProperty(hash, name, checkValid); - } + } + @Override + public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { + switch (hash) { + case -911343192: /*allowed*/ + return this.allowed == null ? new Base[0] : new Base[]{this.allowed}; // Type + case -934964668: /*reason*/ + return this.reason == null ? new Base[0] : new Base[]{this.reason}; // CodeableConcept + default: + return super.getProperty(hash, name, checkValid); } - @Override - public Base setProperty(int hash, String name, Base value) throws FHIRException { - switch (hash) { + } + + @Override + public Base setProperty(int hash, String name, Base value) throws FHIRException { + switch (hash) { case -911343192: // allowed this.allowed = castToType(value); // Type return value; case -934964668: // reason this.reason = castToCodeableConcept(value); // CodeableConcept return value; - default: return super.setProperty(hash, name, value); - } - + default: + return super.setProperty(hash, name, value); } - @Override - public Base setProperty(String name, Base value) throws FHIRException { - if (name.equals("allowed[x]")) { - this.allowed = castToType(value); // Type - } else if (name.equals("reason")) { - this.reason = castToCodeableConcept(value); // CodeableConcept - } else - return super.setProperty(name, value); - return value; + } + + @Override + public Base setProperty(String name, Base value) throws FHIRException { + if (name.equals("allowed[x]")) { + this.allowed = castToType(value); // Type + } else if (name.equals("reason")) { + this.reason = castToCodeableConcept(value); // CodeableConcept + } else + return super.setProperty(name, value); + return value; + } + + @Override + public Base makeProperty(int hash, String name) throws FHIRException { + switch (hash) { + case -1336663592: + return getAllowed(); + case -911343192: + return getAllowed(); + case -934964668: + return getReason(); + default: + return super.makeProperty(hash, name); } - @Override - public Base makeProperty(int hash, String name) throws FHIRException { - switch (hash) { - case -1336663592: return getAllowed(); - case -911343192: return getAllowed(); - case -934964668: return getReason(); - default: return super.makeProperty(hash, name); - } + } + @Override + public String[] getTypesForProperty(int hash, String name) throws FHIRException { + switch (hash) { + case -911343192: /*allowed*/ + return new String[]{"boolean", "CodeableConcept"}; + case -934964668: /*reason*/ + return new String[]{"CodeableConcept"}; + default: + return super.getTypesForProperty(hash, name); } - @Override - public String[] getTypesForProperty(int hash, String name) throws FHIRException { - switch (hash) { - case -911343192: /*allowed*/ return new String[] {"boolean", "CodeableConcept"}; - case -934964668: /*reason*/ return new String[] {"CodeableConcept"}; - default: return super.getTypesForProperty(hash, name); - } + } - } + @Override + public Base addChild(String name) throws FHIRException { + if (name.equals("allowedBoolean")) { + this.allowed = new BooleanType(); + return this.allowed; + } else if (name.equals("allowedCodeableConcept")) { + this.allowed = new CodeableConcept(); + return this.allowed; + } else if (name.equals("reason")) { + this.reason = new CodeableConcept(); + return this.reason; + } else + return super.addChild(name); + } - @Override - public Base addChild(String name) throws FHIRException { - if (name.equals("allowedBoolean")) { - this.allowed = new BooleanType(); - return this.allowed; - } - else if (name.equals("allowedCodeableConcept")) { - this.allowed = new CodeableConcept(); - return this.allowed; - } - else if (name.equals("reason")) { - this.reason = new CodeableConcept(); - return this.reason; - } - else - return super.addChild(name); - } + public MedicationRequestSubstitutionComponent copy() { + MedicationRequestSubstitutionComponent dst = new MedicationRequestSubstitutionComponent(); + copyValues(dst); + dst.allowed = allowed == null ? null : allowed.copy(); + dst.reason = reason == null ? null : reason.copy(); + return dst; + } - public MedicationRequestSubstitutionComponent copy() { - MedicationRequestSubstitutionComponent dst = new MedicationRequestSubstitutionComponent(); - copyValues(dst); - dst.allowed = allowed == null ? null : allowed.copy(); - dst.reason = reason == null ? null : reason.copy(); - return dst; - } + @Override + public boolean equalsDeep(Base other_) { + if (!super.equalsDeep(other_)) + return false; + if (!(other_ instanceof MedicationRequestSubstitutionComponent)) + return false; + MedicationRequestSubstitutionComponent o = (MedicationRequestSubstitutionComponent) other_; + return compareDeep(allowed, o.allowed, true) && compareDeep(reason, o.reason, true); + } - @Override - public boolean equalsDeep(Base other_) { - if (!super.equalsDeep(other_)) - return false; - if (!(other_ instanceof MedicationRequestSubstitutionComponent)) - return false; - MedicationRequestSubstitutionComponent o = (MedicationRequestSubstitutionComponent) other_; - return compareDeep(allowed, o.allowed, true) && compareDeep(reason, o.reason, true); - } + @Override + public boolean equalsShallow(Base other_) { + if (!super.equalsShallow(other_)) + return false; + if (!(other_ instanceof MedicationRequestSubstitutionComponent)) + return false; + MedicationRequestSubstitutionComponent o = (MedicationRequestSubstitutionComponent) other_; + return true; + } - @Override - public boolean equalsShallow(Base other_) { - if (!super.equalsShallow(other_)) - return false; - if (!(other_ instanceof MedicationRequestSubstitutionComponent)) - return false; - MedicationRequestSubstitutionComponent o = (MedicationRequestSubstitutionComponent) other_; + public boolean isEmpty() { + return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(allowed, reason); + } + + public String fhirType() { + return "MedicationRequest.substitution"; + + } + + } + + /** + * Identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server. + */ + @Child(name = "identifier", type = {Identifier.class}, order = 0, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) + @Description(shortDefinition = "External ids for this request", formalDefinition = "Identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.") + protected List identifier; + + /** + * A code specifying the current state of the order. Generally, this will be active or completed state. + */ + @Child(name = "status", type = {CodeType.class}, order = 1, min = 1, max = 1, modifier = true, summary = true) + @Description(shortDefinition = "active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown", formalDefinition = "A code specifying the current state of the order. Generally, this will be active or completed state.") + @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/medicationrequest-status") + protected Enumeration status; + + /** + * Captures the reason for the current state of the MedicationRequest. + */ + @Child(name = "statusReason", type = {CodeableConcept.class}, order = 2, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "Reason for current status", formalDefinition = "Captures the reason for the current state of the MedicationRequest.") + @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/medicationrequest-status-reason") + protected CodeableConcept statusReason; + + /** + * Whether the request is a proposal, plan, or an original order. + */ + @Child(name = "intent", type = {CodeType.class}, order = 3, min = 1, max = 1, modifier = true, summary = true) + @Description(shortDefinition = "proposal | plan | order | original-order | instance-order | option", formalDefinition = "Whether the request is a proposal, plan, or an original order.") + @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/medicationrequest-intent") + protected Enumeration intent; + + /** + * Indicates the type of medication request (for example, where the medication is expected to be consumed or administered (i.e. inpatient or outpatient)). + */ + @Child(name = "category", type = {CodeableConcept.class}, order = 4, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) + @Description(shortDefinition = "Type of medication usage", formalDefinition = "Indicates the type of medication request (for example, where the medication is expected to be consumed or administered (i.e. inpatient or outpatient)).") + @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/medicationrequest-category") + protected List category; + + /** + * Indicates how quickly the Medication Request should be addressed with respect to other requests. + */ + @Child(name = "priority", type = {CodeType.class}, order = 5, min = 0, max = 1, modifier = false, summary = true) + @Description(shortDefinition = "routine | urgent | asap | stat", formalDefinition = "Indicates how quickly the Medication Request should be addressed with respect to other requests.") + @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/request-priority") + protected Enumeration priority; + + /** + * If true indicates that the provider is asking for the medication request not to occur. + */ + @Child(name = "doNotPerform", type = {BooleanType.class}, order = 6, min = 0, max = 1, modifier = true, summary = true) + @Description(shortDefinition = "True if request is prohibiting action", formalDefinition = "If true indicates that the provider is asking for the medication request not to occur.") + protected BooleanType doNotPerform; + + /** + * Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report. + */ + @Child(name = "reported", type = {BooleanType.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class, Organization.class}, order = 7, min = 0, max = 1, modifier = false, summary = true) + @Description(shortDefinition = "Reported rather than primary record", formalDefinition = "Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.") + protected Type reported; + + /** + * Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications. + */ + @Child(name = "medication", type = {CodeableConcept.class, Medication.class}, order = 8, min = 1, max = 1, modifier = false, summary = true) + @Description(shortDefinition = "Medication to be taken", formalDefinition = "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.") + @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/medication-codes") + protected Type medication; + + /** + * A link to a resource representing the person or set of individuals to whom the medication will be given. + */ + @Child(name = "subject", type = {Patient.class, Group.class}, order = 9, min = 1, max = 1, modifier = false, summary = true) + @Description(shortDefinition = "Who or group medication request is for", formalDefinition = "A link to a resource representing the person or set of individuals to whom the medication will be given.") + protected Reference subject; + + /** + * The actual object that is the target of the reference (A link to a resource representing the person or set of individuals to whom the medication will be given.) + */ + protected Resource subjectTarget; + + /** + * The Encounter during which this [x] was created or to which the creation of this record is tightly associated. + */ + @Child(name = "encounter", type = {Encounter.class}, order = 10, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "Encounter created as part of encounter/admission/stay", formalDefinition = "The Encounter during which this [x] was created or to which the creation of this record is tightly associated.") + protected Reference encounter; + + /** + * The actual object that is the target of the reference (The Encounter during which this [x] was created or to which the creation of this record is tightly associated.) + */ + protected Encounter encounterTarget; + + /** + * Include additional information (for example, patient height and weight) that supports the ordering of the medication. + */ + @Child(name = "supportingInformation", type = {Reference.class}, order = 11, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) + @Description(shortDefinition = "Information to support ordering of the medication", formalDefinition = "Include additional information (for example, patient height and weight) that supports the ordering of the medication.") + protected List supportingInformation; + /** + * The actual objects that are the target of the reference (Include additional information (for example, patient height and weight) that supports the ordering of the medication.) + */ + protected List supportingInformationTarget; + + + /** + * The date (and perhaps time) when the prescription was initially written or authored on. + */ + @Child(name = "authoredOn", type = {DateTimeType.class}, order = 12, min = 0, max = 1, modifier = false, summary = true) + @Description(shortDefinition = "When request was initially authored", formalDefinition = "The date (and perhaps time) when the prescription was initially written or authored on.") + protected DateTimeType authoredOn; + + /** + * The individual, organization, or device that initiated the request and has responsibility for its activation. + */ + @Child(name = "requester", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class, Device.class}, order = 13, min = 0, max = 1, modifier = false, summary = true) + @Description(shortDefinition = "Who/What requested the Request", formalDefinition = "The individual, organization, or device that initiated the request and has responsibility for its activation.") + protected Reference requester; + + /** + * The actual object that is the target of the reference (The individual, organization, or device that initiated the request and has responsibility for its activation.) + */ + protected Resource requesterTarget; + + /** + * The specified desired performer of the medication treatment (e.g. the performer of the medication administration). + */ + @Child(name = "performer", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, Device.class, RelatedPerson.class, CareTeam.class}, order = 14, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "Intended performer of administration", formalDefinition = "The specified desired performer of the medication treatment (e.g. the performer of the medication administration).") + protected Reference performer; + + /** + * The actual object that is the target of the reference (The specified desired performer of the medication treatment (e.g. the performer of the medication administration).) + */ + protected Resource performerTarget; + + /** + * Indicates the type of performer of the administration of the medication. + */ + @Child(name = "performerType", type = {CodeableConcept.class}, order = 15, min = 0, max = 1, modifier = false, summary = true) + @Description(shortDefinition = "Desired kind of performer of the medication administration", formalDefinition = "Indicates the type of performer of the administration of the medication.") + @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/performer-role") + protected CodeableConcept performerType; + + /** + * The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order. + */ + @Child(name = "recorder", type = {Practitioner.class, PractitionerRole.class}, order = 16, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "Person who entered the request", formalDefinition = "The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.") + protected Reference recorder; + + /** + * The actual object that is the target of the reference (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.) + */ + protected Resource recorderTarget; + + /** + * The reason or the indication for ordering or not ordering the medication. + */ + @Child(name = "reasonCode", type = {CodeableConcept.class}, order = 17, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) + @Description(shortDefinition = "Reason or indication for ordering or not ordering the medication", formalDefinition = "The reason or the indication for ordering or not ordering the medication.") + @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/condition-code") + protected List reasonCode; + + /** + * Condition or observation that supports why the medication was ordered. + */ + @Child(name = "reasonReference", type = {Condition.class, Observation.class}, order = 18, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) + @Description(shortDefinition = "Condition or observation that supports why the prescription is being written", formalDefinition = "Condition or observation that supports why the medication was ordered.") + protected List reasonReference; + /** + * The actual objects that are the target of the reference (Condition or observation that supports why the medication was ordered.) + */ + protected List reasonReferenceTarget; + + + /** + * The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest. + */ + @Child(name = "instantiatesCanonical", type = {CanonicalType.class}, order = 19, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) + @Description(shortDefinition = "Instantiates FHIR protocol or definition", formalDefinition = "The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.") + protected List instantiatesCanonical; + + /** + * The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest. + */ + @Child(name = "instantiatesUri", type = {UriType.class}, order = 20, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) + @Description(shortDefinition = "Instantiates external protocol or definition", formalDefinition = "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.") + protected List instantiatesUri; + + /** + * A plan or request that is fulfilled in whole or in part by this medication request. + */ + @Child(name = "basedOn", type = {CarePlan.class, MedicationRequest.class, ServiceRequest.class, ImmunizationRecommendation.class}, order = 21, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = true) + @Description(shortDefinition = "What request fulfills", formalDefinition = "A plan or request that is fulfilled in whole or in part by this medication request.") + protected List basedOn; + /** + * The actual objects that are the target of the reference (A plan or request that is fulfilled in whole or in part by this medication request.) + */ + protected List basedOnTarget; + + + /** + * A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription. + */ + @Child(name = "groupIdentifier", type = {Identifier.class}, order = 22, min = 0, max = 1, modifier = false, summary = true) + @Description(shortDefinition = "Composite request this is part of", formalDefinition = "A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.") + protected Identifier groupIdentifier; + + /** + * The description of the overall patte3rn of the administration of the medication to the patient. + */ + @Child(name = "courseOfTherapyType", type = {CodeableConcept.class}, order = 23, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "Overall pattern of medication administration", formalDefinition = "The description of the overall patte3rn of the administration of the medication to the patient.") + @ca.uhn.fhir.model.api.annotation.Binding(valueSet = "http://hl7.org/fhir/ValueSet/medicationrequest-course-of-therapy") + protected CodeableConcept courseOfTherapyType; + + /** + * Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service. + */ + @Child(name = "insurance", type = {Coverage.class, ClaimResponse.class}, order = 24, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) + @Description(shortDefinition = "Associated insurance coverage", formalDefinition = "Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.") + protected List insurance; + /** + * The actual objects that are the target of the reference (Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.) + */ + protected List insuranceTarget; + + + /** + * Extra information about the prescription that could not be conveyed by the other attributes. + */ + @Child(name = "note", type = {Annotation.class}, order = 25, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) + @Description(shortDefinition = "Information about the prescription", formalDefinition = "Extra information about the prescription that could not be conveyed by the other attributes.") + protected List note; + + /** + * Indicates how the medication is to be used by the patient. + */ + @Child(name = "dosageInstruction", type = {Dosage.class}, order = 26, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) + @Description(shortDefinition = "How the medication should be taken", formalDefinition = "Indicates how the medication is to be used by the patient.") + protected List dosageInstruction; + + /** + * Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department. + */ + @Child(name = "dispenseRequest", type = {}, order = 27, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "Medication supply authorization", formalDefinition = "Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.") + protected MedicationRequestDispenseRequestComponent dispenseRequest; + + /** + * Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done. + */ + @Child(name = "substitution", type = {}, order = 28, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "Any restrictions on medication substitution", formalDefinition = "Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.") + protected MedicationRequestSubstitutionComponent substitution; + + /** + * A link to a resource representing an earlier order related order or prescription. + */ + @Child(name = "priorPrescription", type = {MedicationRequest.class}, order = 29, min = 0, max = 1, modifier = false, summary = false) + @Description(shortDefinition = "An order/prescription that is being replaced", formalDefinition = "A link to a resource representing an earlier order related order or prescription.") + protected Reference priorPrescription; + + /** + * The actual object that is the target of the reference (A link to a resource representing an earlier order related order or prescription.) + */ + protected MedicationRequest priorPrescriptionTarget; + + /** + * Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc. + */ + @Child(name = "detectedIssue", type = {DetectedIssue.class}, order = 30, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) + @Description(shortDefinition = "Clinical Issue with action", formalDefinition = "Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc.") + protected List detectedIssue; + /** + * The actual objects that are the target of the reference (Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc.) + */ + protected List detectedIssueTarget; + + + /** + * Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource. + */ + @Child(name = "eventHistory", type = {Provenance.class}, order = 31, min = 0, max = Child.MAX_UNLIMITED, modifier = false, summary = false) + @Description(shortDefinition = "A list of events of interest in the lifecycle", formalDefinition = "Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.") + protected List eventHistory; + /** + * The actual objects that are the target of the reference (Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.) + */ + protected List eventHistoryTarget; + + + private static final long serialVersionUID = 1313900480L; + + /** + * Constructor + */ + public MedicationRequest() { + super(); + } + + /** + * Constructor + */ + public MedicationRequest(Enumeration status, Enumeration intent, Type medication, Reference subject) { + super(); + this.status = status; + this.intent = intent; + this.medication = medication; + this.subject = subject; + } + + /** + * @return {@link #identifier} (Identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.) + */ + public List getIdentifier() { + if (this.identifier == null) + this.identifier = new ArrayList(); + return this.identifier; + } + + /** + * @return Returns a reference to this for easy method chaining + */ + public MedicationRequest setIdentifier(List theIdentifier) { + this.identifier = theIdentifier; + return this; + } + + public boolean hasIdentifier() { + if (this.identifier == null) + return false; + for (Identifier item : this.identifier) + if (!item.isEmpty()) return true; - } - - public boolean isEmpty() { - return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(allowed, reason); - } - - public String fhirType() { - return "MedicationRequest.substitution"; - + return false; } + public Identifier addIdentifier() { //3 + Identifier t = new Identifier(); + if (this.identifier == null) + this.identifier = new ArrayList(); + this.identifier.add(t); + return t; } - /** - * Identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server. - */ - @Child(name = "identifier", type = {Identifier.class}, order=0, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) - @Description(shortDefinition="External ids for this request", formalDefinition="Identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server." ) - protected List identifier; - - /** - * A code specifying the current state of the order. Generally, this will be active or completed state. - */ - @Child(name = "status", type = {CodeType.class}, order=1, min=1, max=1, modifier=true, summary=true) - @Description(shortDefinition="active | on-hold | cancelled | completed | entered-in-error | stopped | draft | unknown", formalDefinition="A code specifying the current state of the order. Generally, this will be active or completed state." ) - @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medicationrequest-status") - protected Enumeration status; - - /** - * Captures the reason for the current state of the MedicationRequest. - */ - @Child(name = "statusReason", type = {CodeableConcept.class}, order=2, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="Reason for current status", formalDefinition="Captures the reason for the current state of the MedicationRequest." ) - @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medicationrequest-status-reason") - protected CodeableConcept statusReason; - - /** - * Whether the request is a proposal, plan, or an original order. - */ - @Child(name = "intent", type = {CodeType.class}, order=3, min=1, max=1, modifier=true, summary=true) - @Description(shortDefinition="proposal | plan | order | original-order | instance-order | option", formalDefinition="Whether the request is a proposal, plan, or an original order." ) - @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medicationrequest-intent") - protected Enumeration intent; - - /** - * Indicates the type of medication request (for example, where the medication is expected to be consumed or administered (i.e. inpatient or outpatient)). - */ - @Child(name = "category", type = {CodeableConcept.class}, order=4, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) - @Description(shortDefinition="Type of medication usage", formalDefinition="Indicates the type of medication request (for example, where the medication is expected to be consumed or administered (i.e. inpatient or outpatient))." ) - @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medicationrequest-category") - protected List category; - - /** - * Indicates how quickly the Medication Request should be addressed with respect to other requests. - */ - @Child(name = "priority", type = {CodeType.class}, order=5, min=0, max=1, modifier=false, summary=true) - @Description(shortDefinition="routine | urgent | asap | stat", formalDefinition="Indicates how quickly the Medication Request should be addressed with respect to other requests." ) - @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/request-priority") - protected Enumeration priority; - - /** - * If true indicates that the provider is asking for the medication request not to occur. - */ - @Child(name = "doNotPerform", type = {BooleanType.class}, order=6, min=0, max=1, modifier=true, summary=true) - @Description(shortDefinition="True if request is prohibiting action", formalDefinition="If true indicates that the provider is asking for the medication request not to occur." ) - protected BooleanType doNotPerform; - - /** - * Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report. - */ - @Child(name = "reported", type = {BooleanType.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class, Organization.class}, order=7, min=0, max=1, modifier=false, summary=true) - @Description(shortDefinition="Reported rather than primary record", formalDefinition="Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report." ) - protected Type reported; - - /** - * Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications. - */ - @Child(name = "medication", type = {CodeableConcept.class, Medication.class}, order=8, min=1, max=1, modifier=false, summary=true) - @Description(shortDefinition="Medication to be taken", formalDefinition="Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications." ) - @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medication-codes") - protected Type medication; - - /** - * A link to a resource representing the person or set of individuals to whom the medication will be given. - */ - @Child(name = "subject", type = {Patient.class, Group.class}, order=9, min=1, max=1, modifier=false, summary=true) - @Description(shortDefinition="Who or group medication request is for", formalDefinition="A link to a resource representing the person or set of individuals to whom the medication will be given." ) - protected Reference subject; - - /** - * The actual object that is the target of the reference (A link to a resource representing the person or set of individuals to whom the medication will be given.) - */ - protected Resource subjectTarget; - - /** - * The Encounter during which this [x] was created or to which the creation of this record is tightly associated. - */ - @Child(name = "encounter", type = {Encounter.class}, order=10, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="Encounter created as part of encounter/admission/stay", formalDefinition="The Encounter during which this [x] was created or to which the creation of this record is tightly associated." ) - protected Reference encounter; - - /** - * The actual object that is the target of the reference (The Encounter during which this [x] was created or to which the creation of this record is tightly associated.) - */ - protected Encounter encounterTarget; - - /** - * Include additional information (for example, patient height and weight) that supports the ordering of the medication. - */ - @Child(name = "supportingInformation", type = {Reference.class}, order=11, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) - @Description(shortDefinition="Information to support ordering of the medication", formalDefinition="Include additional information (for example, patient height and weight) that supports the ordering of the medication." ) - protected List supportingInformation; - /** - * The actual objects that are the target of the reference (Include additional information (for example, patient height and weight) that supports the ordering of the medication.) - */ - protected List supportingInformationTarget; - - - /** - * The date (and perhaps time) when the prescription was initially written or authored on. - */ - @Child(name = "authoredOn", type = {DateTimeType.class}, order=12, min=0, max=1, modifier=false, summary=true) - @Description(shortDefinition="When request was initially authored", formalDefinition="The date (and perhaps time) when the prescription was initially written or authored on." ) - protected DateTimeType authoredOn; - - /** - * The individual, organization, or device that initiated the request and has responsibility for its activation. - */ - @Child(name = "requester", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, RelatedPerson.class, Device.class}, order=13, min=0, max=1, modifier=false, summary=true) - @Description(shortDefinition="Who/What requested the Request", formalDefinition="The individual, organization, or device that initiated the request and has responsibility for its activation." ) - protected Reference requester; - - /** - * The actual object that is the target of the reference (The individual, organization, or device that initiated the request and has responsibility for its activation.) - */ - protected Resource requesterTarget; - - /** - * The specified desired performer of the medication treatment (e.g. the performer of the medication administration). - */ - @Child(name = "performer", type = {Practitioner.class, PractitionerRole.class, Organization.class, Patient.class, Device.class, RelatedPerson.class, CareTeam.class}, order=14, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="Intended performer of administration", formalDefinition="The specified desired performer of the medication treatment (e.g. the performer of the medication administration)." ) - protected Reference performer; - - /** - * The actual object that is the target of the reference (The specified desired performer of the medication treatment (e.g. the performer of the medication administration).) - */ - protected Resource performerTarget; - - /** - * Indicates the type of performer of the administration of the medication. - */ - @Child(name = "performerType", type = {CodeableConcept.class}, order=15, min=0, max=1, modifier=false, summary=true) - @Description(shortDefinition="Desired kind of performer of the medication administration", formalDefinition="Indicates the type of performer of the administration of the medication." ) - @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/performer-role") - protected CodeableConcept performerType; - - /** - * The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order. - */ - @Child(name = "recorder", type = {Practitioner.class, PractitionerRole.class}, order=16, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="Person who entered the request", formalDefinition="The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order." ) - protected Reference recorder; - - /** - * The actual object that is the target of the reference (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.) - */ - protected Resource recorderTarget; - - /** - * The reason or the indication for ordering or not ordering the medication. - */ - @Child(name = "reasonCode", type = {CodeableConcept.class}, order=17, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) - @Description(shortDefinition="Reason or indication for ordering or not ordering the medication", formalDefinition="The reason or the indication for ordering or not ordering the medication." ) - @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/condition-code") - protected List reasonCode; - - /** - * Condition or observation that supports why the medication was ordered. - */ - @Child(name = "reasonReference", type = {Condition.class, Observation.class}, order=18, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) - @Description(shortDefinition="Condition or observation that supports why the prescription is being written", formalDefinition="Condition or observation that supports why the medication was ordered." ) - protected List reasonReference; - /** - * The actual objects that are the target of the reference (Condition or observation that supports why the medication was ordered.) - */ - protected List reasonReferenceTarget; - - - /** - * The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest. - */ - @Child(name = "instantiatesCanonical", type = {CanonicalType.class}, order=19, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) - @Description(shortDefinition="Instantiates FHIR protocol or definition", formalDefinition="The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest." ) - protected List instantiatesCanonical; - - /** - * The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest. - */ - @Child(name = "instantiatesUri", type = {UriType.class}, order=20, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) - @Description(shortDefinition="Instantiates external protocol or definition", formalDefinition="The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest." ) - protected List instantiatesUri; - - /** - * A plan or request that is fulfilled in whole or in part by this medication request. - */ - @Child(name = "basedOn", type = {CarePlan.class, MedicationRequest.class, ServiceRequest.class, ImmunizationRecommendation.class}, order=21, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=true) - @Description(shortDefinition="What request fulfills", formalDefinition="A plan or request that is fulfilled in whole or in part by this medication request." ) - protected List basedOn; - /** - * The actual objects that are the target of the reference (A plan or request that is fulfilled in whole or in part by this medication request.) - */ - protected List basedOnTarget; - - - /** - * A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription. - */ - @Child(name = "groupIdentifier", type = {Identifier.class}, order=22, min=0, max=1, modifier=false, summary=true) - @Description(shortDefinition="Composite request this is part of", formalDefinition="A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription." ) - protected Identifier groupIdentifier; - - /** - * The description of the overall patte3rn of the administration of the medication to the patient. - */ - @Child(name = "courseOfTherapyType", type = {CodeableConcept.class}, order=23, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="Overall pattern of medication administration", formalDefinition="The description of the overall patte3rn of the administration of the medication to the patient." ) - @ca.uhn.fhir.model.api.annotation.Binding(valueSet="http://hl7.org/fhir/ValueSet/medicationrequest-course-of-therapy") - protected CodeableConcept courseOfTherapyType; - - /** - * Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service. - */ - @Child(name = "insurance", type = {Coverage.class, ClaimResponse.class}, order=24, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) - @Description(shortDefinition="Associated insurance coverage", formalDefinition="Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service." ) - protected List insurance; - /** - * The actual objects that are the target of the reference (Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.) - */ - protected List insuranceTarget; - - - /** - * Extra information about the prescription that could not be conveyed by the other attributes. - */ - @Child(name = "note", type = {Annotation.class}, order=25, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) - @Description(shortDefinition="Information about the prescription", formalDefinition="Extra information about the prescription that could not be conveyed by the other attributes." ) - protected List note; - - /** - * Indicates how the medication is to be used by the patient. - */ - @Child(name = "dosageInstruction", type = {Dosage.class}, order=26, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) - @Description(shortDefinition="How the medication should be taken", formalDefinition="Indicates how the medication is to be used by the patient." ) - protected List dosageInstruction; - - /** - * Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department. - */ - @Child(name = "dispenseRequest", type = {}, order=27, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="Medication supply authorization", formalDefinition="Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department." ) - protected MedicationRequestDispenseRequestComponent dispenseRequest; - - /** - * Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done. - */ - @Child(name = "substitution", type = {}, order=28, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="Any restrictions on medication substitution", formalDefinition="Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done." ) - protected MedicationRequestSubstitutionComponent substitution; - - /** - * A link to a resource representing an earlier order related order or prescription. - */ - @Child(name = "priorPrescription", type = {MedicationRequest.class}, order=29, min=0, max=1, modifier=false, summary=false) - @Description(shortDefinition="An order/prescription that is being replaced", formalDefinition="A link to a resource representing an earlier order related order or prescription." ) - protected Reference priorPrescription; - - /** - * The actual object that is the target of the reference (A link to a resource representing an earlier order related order or prescription.) - */ - protected MedicationRequest priorPrescriptionTarget; - - /** - * Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc. - */ - @Child(name = "detectedIssue", type = {DetectedIssue.class}, order=30, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) - @Description(shortDefinition="Clinical Issue with action", formalDefinition="Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc." ) - protected List detectedIssue; - /** - * The actual objects that are the target of the reference (Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc.) - */ - protected List detectedIssueTarget; - - - /** - * Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource. - */ - @Child(name = "eventHistory", type = {Provenance.class}, order=31, min=0, max=Child.MAX_UNLIMITED, modifier=false, summary=false) - @Description(shortDefinition="A list of events of interest in the lifecycle", formalDefinition="Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource." ) - protected List eventHistory; - /** - * The actual objects that are the target of the reference (Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.) - */ - protected List eventHistoryTarget; - - - private static final long serialVersionUID = 1313900480L; + public MedicationRequest addIdentifier(Identifier t) { //3 + if (t == null) + return this; + if (this.identifier == null) + this.identifier = new ArrayList(); + this.identifier.add(t); + return this; + } /** - * Constructor + * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist */ - public MedicationRequest() { - super(); + public Identifier getIdentifierFirstRep() { + if (getIdentifier().isEmpty()) { + addIdentifier(); } + return getIdentifier().get(0); + } /** - * Constructor + * @return {@link #status} (A code specifying the current state of the order. Generally, this will be active or completed state.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value */ - public MedicationRequest(Enumeration status, Enumeration intent, Type medication, Reference subject) { - super(); - this.status = status; - this.intent = intent; - this.medication = medication; - this.subject = subject; - } + public Enumeration getStatusElement() { + if (this.status == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.status"); + else if (Configuration.doAutoCreate()) + this.status = new Enumeration(new MedicationRequestStatusEnumFactory()); // bb + return this.status; + } - /** - * @return {@link #identifier} (Identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.) - */ - public List getIdentifier() { - if (this.identifier == null) - this.identifier = new ArrayList(); - return this.identifier; - } + public boolean hasStatusElement() { + return this.status != null && !this.status.isEmpty(); + } - /** - * @return Returns a reference to this for easy method chaining - */ - public MedicationRequest setIdentifier(List theIdentifier) { - this.identifier = theIdentifier; - return this; - } + public boolean hasStatus() { + return this.status != null && !this.status.isEmpty(); + } - public boolean hasIdentifier() { - if (this.identifier == null) - return false; - for (Identifier item : this.identifier) - if (!item.isEmpty()) - return true; + /** + * @param value {@link #status} (A code specifying the current state of the order. Generally, this will be active or completed state.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value + */ + public MedicationRequest setStatusElement(Enumeration value) { + this.status = value; + return this; + } + + /** + * @return A code specifying the current state of the order. Generally, this will be active or completed state. + */ + public MedicationRequestStatus getStatus() { + return this.status == null ? null : this.status.getValue(); + } + + /** + * @param value A code specifying the current state of the order. Generally, this will be active or completed state. + */ + public MedicationRequest setStatus(MedicationRequestStatus value) { + if (this.status == null) + this.status = new Enumeration(new MedicationRequestStatusEnumFactory()); + this.status.setValue(value); + return this; + } + + /** + * @return {@link #statusReason} (Captures the reason for the current state of the MedicationRequest.) + */ + public CodeableConcept getStatusReason() { + if (this.statusReason == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.statusReason"); + else if (Configuration.doAutoCreate()) + this.statusReason = new CodeableConcept(); // cc + return this.statusReason; + } + + public boolean hasStatusReason() { + return this.statusReason != null && !this.statusReason.isEmpty(); + } + + /** + * @param value {@link #statusReason} (Captures the reason for the current state of the MedicationRequest.) + */ + public MedicationRequest setStatusReason(CodeableConcept value) { + this.statusReason = value; + return this; + } + + /** + * @return {@link #intent} (Whether the request is a proposal, plan, or an original order.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value + */ + public Enumeration getIntentElement() { + if (this.intent == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.intent"); + else if (Configuration.doAutoCreate()) + this.intent = new Enumeration(new MedicationRequestIntentEnumFactory()); // bb + return this.intent; + } + + public boolean hasIntentElement() { + return this.intent != null && !this.intent.isEmpty(); + } + + public boolean hasIntent() { + return this.intent != null && !this.intent.isEmpty(); + } + + /** + * @param value {@link #intent} (Whether the request is a proposal, plan, or an original order.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value + */ + public MedicationRequest setIntentElement(Enumeration value) { + this.intent = value; + return this; + } + + /** + * @return Whether the request is a proposal, plan, or an original order. + */ + public MedicationRequestIntent getIntent() { + return this.intent == null ? null : this.intent.getValue(); + } + + /** + * @param value Whether the request is a proposal, plan, or an original order. + */ + public MedicationRequest setIntent(MedicationRequestIntent value) { + if (this.intent == null) + this.intent = new Enumeration(new MedicationRequestIntentEnumFactory()); + this.intent.setValue(value); + return this; + } + + /** + * @return {@link #category} (Indicates the type of medication request (for example, where the medication is expected to be consumed or administered (i.e. inpatient or outpatient)).) + */ + public List getCategory() { + if (this.category == null) + this.category = new ArrayList(); + return this.category; + } + + /** + * @return Returns a reference to this for easy method chaining + */ + public MedicationRequest setCategory(List theCategory) { + this.category = theCategory; + return this; + } + + public boolean hasCategory() { + if (this.category == null) return false; - } + for (CodeableConcept item : this.category) + if (!item.isEmpty()) + return true; + return false; + } - public Identifier addIdentifier() { //3 - Identifier t = new Identifier(); - if (this.identifier == null) - this.identifier = new ArrayList(); - this.identifier.add(t); - return t; - } + public CodeableConcept addCategory() { //3 + CodeableConcept t = new CodeableConcept(); + if (this.category == null) + this.category = new ArrayList(); + this.category.add(t); + return t; + } - public MedicationRequest addIdentifier(Identifier t) { //3 - if (t == null) - return this; - if (this.identifier == null) - this.identifier = new ArrayList(); - this.identifier.add(t); + public MedicationRequest addCategory(CodeableConcept t) { //3 + if (t == null) return this; - } + if (this.category == null) + this.category = new ArrayList(); + this.category.add(t); + return this; + } - /** - * @return The first repetition of repeating field {@link #identifier}, creating it if it does not already exist - */ - public Identifier getIdentifierFirstRep() { - if (getIdentifier().isEmpty()) { - addIdentifier(); - } - return getIdentifier().get(0); + /** + * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist + */ + public CodeableConcept getCategoryFirstRep() { + if (getCategory().isEmpty()) { + addCategory(); } + return getCategory().get(0); + } - /** - * @return {@link #status} (A code specifying the current state of the order. Generally, this will be active or completed state.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value - */ - public Enumeration getStatusElement() { - if (this.status == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.status"); - else if (Configuration.doAutoCreate()) - this.status = new Enumeration(new MedicationRequestStatusEnumFactory()); // bb - return this.status; - } + /** + * @return {@link #priority} (Indicates how quickly the Medication Request should be addressed with respect to other requests.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value + */ + public Enumeration getPriorityElement() { + if (this.priority == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.priority"); + else if (Configuration.doAutoCreate()) + this.priority = new Enumeration(new MedicationRequestPriorityEnumFactory()); // bb + return this.priority; + } - public boolean hasStatusElement() { - return this.status != null && !this.status.isEmpty(); - } + public boolean hasPriorityElement() { + return this.priority != null && !this.priority.isEmpty(); + } - public boolean hasStatus() { - return this.status != null && !this.status.isEmpty(); - } + public boolean hasPriority() { + return this.priority != null && !this.priority.isEmpty(); + } - /** - * @param value {@link #status} (A code specifying the current state of the order. Generally, this will be active or completed state.). This is the underlying object with id, value and extensions. The accessor "getStatus" gives direct access to the value - */ - public MedicationRequest setStatusElement(Enumeration value) { - this.status = value; - return this; - } + /** + * @param value {@link #priority} (Indicates how quickly the Medication Request should be addressed with respect to other requests.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value + */ + public MedicationRequest setPriorityElement(Enumeration value) { + this.priority = value; + return this; + } - /** - * @return A code specifying the current state of the order. Generally, this will be active or completed state. - */ - public MedicationRequestStatus getStatus() { - return this.status == null ? null : this.status.getValue(); - } + /** + * @return Indicates how quickly the Medication Request should be addressed with respect to other requests. + */ + public MedicationRequestPriority getPriority() { + return this.priority == null ? null : this.priority.getValue(); + } - /** - * @param value A code specifying the current state of the order. Generally, this will be active or completed state. - */ - public MedicationRequest setStatus(MedicationRequestStatus value) { - if (this.status == null) - this.status = new Enumeration(new MedicationRequestStatusEnumFactory()); - this.status.setValue(value); - return this; - } - - /** - * @return {@link #statusReason} (Captures the reason for the current state of the MedicationRequest.) - */ - public CodeableConcept getStatusReason() { - if (this.statusReason == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.statusReason"); - else if (Configuration.doAutoCreate()) - this.statusReason = new CodeableConcept(); // cc - return this.statusReason; - } - - public boolean hasStatusReason() { - return this.statusReason != null && !this.statusReason.isEmpty(); - } - - /** - * @param value {@link #statusReason} (Captures the reason for the current state of the MedicationRequest.) - */ - public MedicationRequest setStatusReason(CodeableConcept value) { - this.statusReason = value; - return this; - } - - /** - * @return {@link #intent} (Whether the request is a proposal, plan, or an original order.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value - */ - public Enumeration getIntentElement() { - if (this.intent == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.intent"); - else if (Configuration.doAutoCreate()) - this.intent = new Enumeration(new MedicationRequestIntentEnumFactory()); // bb - return this.intent; - } - - public boolean hasIntentElement() { - return this.intent != null && !this.intent.isEmpty(); - } - - public boolean hasIntent() { - return this.intent != null && !this.intent.isEmpty(); - } - - /** - * @param value {@link #intent} (Whether the request is a proposal, plan, or an original order.). This is the underlying object with id, value and extensions. The accessor "getIntent" gives direct access to the value - */ - public MedicationRequest setIntentElement(Enumeration value) { - this.intent = value; - return this; - } - - /** - * @return Whether the request is a proposal, plan, or an original order. - */ - public MedicationRequestIntent getIntent() { - return this.intent == null ? null : this.intent.getValue(); - } - - /** - * @param value Whether the request is a proposal, plan, or an original order. - */ - public MedicationRequest setIntent(MedicationRequestIntent value) { - if (this.intent == null) - this.intent = new Enumeration(new MedicationRequestIntentEnumFactory()); - this.intent.setValue(value); - return this; - } - - /** - * @return {@link #category} (Indicates the type of medication request (for example, where the medication is expected to be consumed or administered (i.e. inpatient or outpatient)).) - */ - public List getCategory() { - if (this.category == null) - this.category = new ArrayList(); - return this.category; - } - - /** - * @return Returns a reference to this for easy method chaining - */ - public MedicationRequest setCategory(List theCategory) { - this.category = theCategory; - return this; - } - - public boolean hasCategory() { - if (this.category == null) - return false; - for (CodeableConcept item : this.category) - if (!item.isEmpty()) - return true; - return false; - } - - public CodeableConcept addCategory() { //3 - CodeableConcept t = new CodeableConcept(); - if (this.category == null) - this.category = new ArrayList(); - this.category.add(t); - return t; - } - - public MedicationRequest addCategory(CodeableConcept t) { //3 - if (t == null) - return this; - if (this.category == null) - this.category = new ArrayList(); - this.category.add(t); - return this; - } - - /** - * @return The first repetition of repeating field {@link #category}, creating it if it does not already exist - */ - public CodeableConcept getCategoryFirstRep() { - if (getCategory().isEmpty()) { - addCategory(); - } - return getCategory().get(0); - } - - /** - * @return {@link #priority} (Indicates how quickly the Medication Request should be addressed with respect to other requests.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value - */ - public Enumeration getPriorityElement() { + /** + * @param value Indicates how quickly the Medication Request should be addressed with respect to other requests. + */ + public MedicationRequest setPriority(MedicationRequestPriority value) { + if (value == null) + this.priority = null; + else { if (this.priority == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.priority"); - else if (Configuration.doAutoCreate()) - this.priority = new Enumeration(new MedicationRequestPriorityEnumFactory()); // bb - return this.priority; + this.priority = new Enumeration(new MedicationRequestPriorityEnumFactory()); + this.priority.setValue(value); } + return this; + } - public boolean hasPriorityElement() { - return this.priority != null && !this.priority.isEmpty(); - } + /** + * @return {@link #doNotPerform} (If true indicates that the provider is asking for the medication request not to occur.). This is the underlying object with id, value and extensions. The accessor "getDoNotPerform" gives direct access to the value + */ + public BooleanType getDoNotPerformElement() { + if (this.doNotPerform == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.doNotPerform"); + else if (Configuration.doAutoCreate()) + this.doNotPerform = new BooleanType(); // bb + return this.doNotPerform; + } - public boolean hasPriority() { - return this.priority != null && !this.priority.isEmpty(); - } + public boolean hasDoNotPerformElement() { + return this.doNotPerform != null && !this.doNotPerform.isEmpty(); + } - /** - * @param value {@link #priority} (Indicates how quickly the Medication Request should be addressed with respect to other requests.). This is the underlying object with id, value and extensions. The accessor "getPriority" gives direct access to the value - */ - public MedicationRequest setPriorityElement(Enumeration value) { - this.priority = value; - return this; - } + public boolean hasDoNotPerform() { + return this.doNotPerform != null && !this.doNotPerform.isEmpty(); + } - /** - * @return Indicates how quickly the Medication Request should be addressed with respect to other requests. - */ - public MedicationRequestPriority getPriority() { - return this.priority == null ? null : this.priority.getValue(); - } + /** + * @param value {@link #doNotPerform} (If true indicates that the provider is asking for the medication request not to occur.). This is the underlying object with id, value and extensions. The accessor "getDoNotPerform" gives direct access to the value + */ + public MedicationRequest setDoNotPerformElement(BooleanType value) { + this.doNotPerform = value; + return this; + } - /** - * @param value Indicates how quickly the Medication Request should be addressed with respect to other requests. - */ - public MedicationRequest setPriority(MedicationRequestPriority value) { - if (value == null) - this.priority = null; - else { - if (this.priority == null) - this.priority = new Enumeration(new MedicationRequestPriorityEnumFactory()); - this.priority.setValue(value); - } - return this; - } + /** + * @return If true indicates that the provider is asking for the medication request not to occur. + */ + public boolean getDoNotPerform() { + return this.doNotPerform == null || this.doNotPerform.isEmpty() ? false : this.doNotPerform.getValue(); + } - /** - * @return {@link #doNotPerform} (If true indicates that the provider is asking for the medication request not to occur.). This is the underlying object with id, value and extensions. The accessor "getDoNotPerform" gives direct access to the value - */ - public BooleanType getDoNotPerformElement() { - if (this.doNotPerform == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.doNotPerform"); - else if (Configuration.doAutoCreate()) - this.doNotPerform = new BooleanType(); // bb - return this.doNotPerform; - } + /** + * @param value If true indicates that the provider is asking for the medication request not to occur. + */ + public MedicationRequest setDoNotPerform(boolean value) { + if (this.doNotPerform == null) + this.doNotPerform = new BooleanType(); + this.doNotPerform.setValue(value); + return this; + } - public boolean hasDoNotPerformElement() { - return this.doNotPerform != null && !this.doNotPerform.isEmpty(); - } + /** + * @return {@link #reported} (Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.) + */ + public Type getReported() { + return this.reported; + } - public boolean hasDoNotPerform() { - return this.doNotPerform != null && !this.doNotPerform.isEmpty(); - } + /** + * @return {@link #reported} (Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.) + */ + public BooleanType getReportedBooleanType() throws FHIRException { + if (this.reported == null) + this.reported = new BooleanType(); + if (!(this.reported instanceof BooleanType)) + throw new FHIRException("Type mismatch: the type BooleanType was expected, but " + this.reported.getClass().getName() + " was encountered"); + return (BooleanType) this.reported; + } - /** - * @param value {@link #doNotPerform} (If true indicates that the provider is asking for the medication request not to occur.). This is the underlying object with id, value and extensions. The accessor "getDoNotPerform" gives direct access to the value - */ - public MedicationRequest setDoNotPerformElement(BooleanType value) { - this.doNotPerform = value; - return this; - } + public boolean hasReportedBooleanType() { + return this != null && this.reported instanceof BooleanType; + } - /** - * @return If true indicates that the provider is asking for the medication request not to occur. - */ - public boolean getDoNotPerform() { - return this.doNotPerform == null || this.doNotPerform.isEmpty() ? false : this.doNotPerform.getValue(); - } + /** + * @return {@link #reported} (Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.) + */ + public Reference getReportedReference() throws FHIRException { + if (this.reported == null) + this.reported = new Reference(); + if (!(this.reported instanceof Reference)) + throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.reported.getClass().getName() + " was encountered"); + return (Reference) this.reported; + } - /** - * @param value If true indicates that the provider is asking for the medication request not to occur. - */ - public MedicationRequest setDoNotPerform(boolean value) { - if (this.doNotPerform == null) - this.doNotPerform = new BooleanType(); - this.doNotPerform.setValue(value); - return this; - } + public boolean hasReportedReference() { + return this != null && this.reported instanceof Reference; + } - /** - * @return {@link #reported} (Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.) - */ - public Type getReported() { - return this.reported; - } + public boolean hasReported() { + return this.reported != null && !this.reported.isEmpty(); + } - /** - * @return {@link #reported} (Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.) - */ - public BooleanType getReportedBooleanType() throws FHIRException { - if (this.reported == null) - this.reported = new BooleanType(); - if (!(this.reported instanceof BooleanType)) - throw new FHIRException("Type mismatch: the type BooleanType was expected, but "+this.reported.getClass().getName()+" was encountered"); - return (BooleanType) this.reported; - } + /** + * @param value {@link #reported} (Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.) + */ + public MedicationRequest setReported(Type value) { + if (value != null && !(value instanceof BooleanType || value instanceof Reference)) + throw new Error("Not the right type for MedicationRequest.reported[x]: " + value.fhirType()); + this.reported = value; + return this; + } - public boolean hasReportedBooleanType() { - return this != null && this.reported instanceof BooleanType; - } + /** + * @return {@link #medication} (Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) + */ + public Type getMedication() { + return this.medication; + } - /** - * @return {@link #reported} (Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.) - */ - public Reference getReportedReference() throws FHIRException { - if (this.reported == null) - this.reported = new Reference(); - if (!(this.reported instanceof Reference)) - throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.reported.getClass().getName()+" was encountered"); - return (Reference) this.reported; - } + /** + * @return {@link #medication} (Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) + */ + public CodeableConcept getMedicationCodeableConcept() throws FHIRException { + if (this.medication == null) + this.medication = new CodeableConcept(); + if (!(this.medication instanceof CodeableConcept)) + throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but " + this.medication.getClass().getName() + " was encountered"); + return (CodeableConcept) this.medication; + } - public boolean hasReportedReference() { - return this != null && this.reported instanceof Reference; - } + public boolean hasMedicationCodeableConcept() { + return this != null && this.medication instanceof CodeableConcept; + } - public boolean hasReported() { - return this.reported != null && !this.reported.isEmpty(); - } + /** + * @return {@link #medication} (Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) + */ + public Reference getMedicationReference() throws FHIRException { + if (this.medication == null) + this.medication = new Reference(); + if (!(this.medication instanceof Reference)) + throw new FHIRException("Type mismatch: the type Reference was expected, but " + this.medication.getClass().getName() + " was encountered"); + return (Reference) this.medication; + } - /** - * @param value {@link #reported} (Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.) - */ - public MedicationRequest setReported(Type value) { - if (value != null && !(value instanceof BooleanType || value instanceof Reference)) - throw new Error("Not the right type for MedicationRequest.reported[x]: "+value.fhirType()); - this.reported = value; - return this; - } + public boolean hasMedicationReference() { + return this != null && this.medication instanceof Reference; + } - /** - * @return {@link #medication} (Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) - */ - public Type getMedication() { - return this.medication; - } + public boolean hasMedication() { + return this.medication != null && !this.medication.isEmpty(); + } - /** - * @return {@link #medication} (Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) - */ - public CodeableConcept getMedicationCodeableConcept() throws FHIRException { - if (this.medication == null) - this.medication = new CodeableConcept(); - if (!(this.medication instanceof CodeableConcept)) - throw new FHIRException("Type mismatch: the type CodeableConcept was expected, but "+this.medication.getClass().getName()+" was encountered"); - return (CodeableConcept) this.medication; - } + /** + * @param value {@link #medication} (Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) + */ + public MedicationRequest setMedication(Type value) { + if (value != null && !(value instanceof CodeableConcept || value instanceof Reference)) + throw new Error("Not the right type for MedicationRequest.medication[x]: " + value.fhirType()); + this.medication = value; + return this; + } - public boolean hasMedicationCodeableConcept() { - return this != null && this.medication instanceof CodeableConcept; - } + /** + * @return {@link #subject} (A link to a resource representing the person or set of individuals to whom the medication will be given.) + */ + public Reference getSubject() { + if (this.subject == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.subject"); + else if (Configuration.doAutoCreate()) + this.subject = new Reference(); // cc + return this.subject; + } - /** - * @return {@link #medication} (Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) - */ - public Reference getMedicationReference() throws FHIRException { - if (this.medication == null) - this.medication = new Reference(); - if (!(this.medication instanceof Reference)) - throw new FHIRException("Type mismatch: the type Reference was expected, but "+this.medication.getClass().getName()+" was encountered"); - return (Reference) this.medication; - } + public boolean hasSubject() { + return this.subject != null && !this.subject.isEmpty(); + } - public boolean hasMedicationReference() { - return this != null && this.medication instanceof Reference; - } + /** + * @param value {@link #subject} (A link to a resource representing the person or set of individuals to whom the medication will be given.) + */ + public MedicationRequest setSubject(Reference value) { + this.subject = value; + return this; + } - public boolean hasMedication() { - return this.medication != null && !this.medication.isEmpty(); - } + /** + * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A link to a resource representing the person or set of individuals to whom the medication will be given.) + */ + public Resource getSubjectTarget() { + return this.subjectTarget; + } - /** - * @param value {@link #medication} (Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.) - */ - public MedicationRequest setMedication(Type value) { - if (value != null && !(value instanceof CodeableConcept || value instanceof Reference)) - throw new Error("Not the right type for MedicationRequest.medication[x]: "+value.fhirType()); - this.medication = value; - return this; - } + /** + * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A link to a resource representing the person or set of individuals to whom the medication will be given.) + */ + public MedicationRequest setSubjectTarget(Resource value) { + this.subjectTarget = value; + return this; + } - /** - * @return {@link #subject} (A link to a resource representing the person or set of individuals to whom the medication will be given.) - */ - public Reference getSubject() { - if (this.subject == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.subject"); - else if (Configuration.doAutoCreate()) - this.subject = new Reference(); // cc - return this.subject; - } + /** + * @return {@link #encounter} (The Encounter during which this [x] was created or to which the creation of this record is tightly associated.) + */ + public Reference getEncounter() { + if (this.encounter == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.encounter"); + else if (Configuration.doAutoCreate()) + this.encounter = new Reference(); // cc + return this.encounter; + } - public boolean hasSubject() { - return this.subject != null && !this.subject.isEmpty(); - } + public boolean hasEncounter() { + return this.encounter != null && !this.encounter.isEmpty(); + } - /** - * @param value {@link #subject} (A link to a resource representing the person or set of individuals to whom the medication will be given.) - */ - public MedicationRequest setSubject(Reference value) { - this.subject = value; - return this; - } + /** + * @param value {@link #encounter} (The Encounter during which this [x] was created or to which the creation of this record is tightly associated.) + */ + public MedicationRequest setEncounter(Reference value) { + this.encounter = value; + return this; + } - /** - * @return {@link #subject} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A link to a resource representing the person or set of individuals to whom the medication will be given.) - */ - public Resource getSubjectTarget() { - return this.subjectTarget; - } + /** + * @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Encounter during which this [x] was created or to which the creation of this record is tightly associated.) + */ + public Encounter getEncounterTarget() { + if (this.encounterTarget == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.encounter"); + else if (Configuration.doAutoCreate()) + this.encounterTarget = new Encounter(); // aa + return this.encounterTarget; + } - /** - * @param value {@link #subject} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A link to a resource representing the person or set of individuals to whom the medication will be given.) - */ - public MedicationRequest setSubjectTarget(Resource value) { - this.subjectTarget = value; - return this; - } + /** + * @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Encounter during which this [x] was created or to which the creation of this record is tightly associated.) + */ + public MedicationRequest setEncounterTarget(Encounter value) { + this.encounterTarget = value; + return this; + } - /** - * @return {@link #encounter} (The Encounter during which this [x] was created or to which the creation of this record is tightly associated.) - */ - public Reference getEncounter() { - if (this.encounter == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.encounter"); - else if (Configuration.doAutoCreate()) - this.encounter = new Reference(); // cc - return this.encounter; - } + /** + * @return {@link #supportingInformation} (Include additional information (for example, patient height and weight) that supports the ordering of the medication.) + */ + public List getSupportingInformation() { + if (this.supportingInformation == null) + this.supportingInformation = new ArrayList(); + return this.supportingInformation; + } - public boolean hasEncounter() { - return this.encounter != null && !this.encounter.isEmpty(); - } + /** + * @return Returns a reference to this for easy method chaining + */ + public MedicationRequest setSupportingInformation(List theSupportingInformation) { + this.supportingInformation = theSupportingInformation; + return this; + } - /** - * @param value {@link #encounter} (The Encounter during which this [x] was created or to which the creation of this record is tightly associated.) - */ - public MedicationRequest setEncounter(Reference value) { - this.encounter = value; - return this; - } - - /** - * @return {@link #encounter} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The Encounter during which this [x] was created or to which the creation of this record is tightly associated.) - */ - public Encounter getEncounterTarget() { - if (this.encounterTarget == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.encounter"); - else if (Configuration.doAutoCreate()) - this.encounterTarget = new Encounter(); // aa - return this.encounterTarget; - } - - /** - * @param value {@link #encounter} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The Encounter during which this [x] was created or to which the creation of this record is tightly associated.) - */ - public MedicationRequest setEncounterTarget(Encounter value) { - this.encounterTarget = value; - return this; - } - - /** - * @return {@link #supportingInformation} (Include additional information (for example, patient height and weight) that supports the ordering of the medication.) - */ - public List getSupportingInformation() { - if (this.supportingInformation == null) - this.supportingInformation = new ArrayList(); - return this.supportingInformation; - } - - /** - * @return Returns a reference to this for easy method chaining - */ - public MedicationRequest setSupportingInformation(List theSupportingInformation) { - this.supportingInformation = theSupportingInformation; - return this; - } - - public boolean hasSupportingInformation() { - if (this.supportingInformation == null) - return false; - for (Reference item : this.supportingInformation) - if (!item.isEmpty()) - return true; + public boolean hasSupportingInformation() { + if (this.supportingInformation == null) return false; - } + for (Reference item : this.supportingInformation) + if (!item.isEmpty()) + return true; + return false; + } - public Reference addSupportingInformation() { //3 - Reference t = new Reference(); - if (this.supportingInformation == null) - this.supportingInformation = new ArrayList(); - this.supportingInformation.add(t); - return t; - } + public Reference addSupportingInformation() { //3 + Reference t = new Reference(); + if (this.supportingInformation == null) + this.supportingInformation = new ArrayList(); + this.supportingInformation.add(t); + return t; + } - public MedicationRequest addSupportingInformation(Reference t) { //3 - if (t == null) - return this; - if (this.supportingInformation == null) - this.supportingInformation = new ArrayList(); - this.supportingInformation.add(t); + public MedicationRequest addSupportingInformation(Reference t) { //3 + if (t == null) return this; - } + if (this.supportingInformation == null) + this.supportingInformation = new ArrayList(); + this.supportingInformation.add(t); + return this; + } - /** - * @return The first repetition of repeating field {@link #supportingInformation}, creating it if it does not already exist - */ - public Reference getSupportingInformationFirstRep() { - if (getSupportingInformation().isEmpty()) { - addSupportingInformation(); - } - return getSupportingInformation().get(0); + /** + * @return The first repetition of repeating field {@link #supportingInformation}, creating it if it does not already exist + */ + public Reference getSupportingInformationFirstRep() { + if (getSupportingInformation().isEmpty()) { + addSupportingInformation(); } + return getSupportingInformation().get(0); + } - /** - * @deprecated Use Reference#setResource(IBaseResource) instead - */ - @Deprecated - public List getSupportingInformationTarget() { - if (this.supportingInformationTarget == null) - this.supportingInformationTarget = new ArrayList(); - return this.supportingInformationTarget; - } + /** + * @deprecated Use Reference#setResource(IBaseResource) instead + */ + @Deprecated + public List getSupportingInformationTarget() { + if (this.supportingInformationTarget == null) + this.supportingInformationTarget = new ArrayList(); + return this.supportingInformationTarget; + } - /** - * @return {@link #authoredOn} (The date (and perhaps time) when the prescription was initially written or authored on.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value - */ - public DateTimeType getAuthoredOnElement() { + /** + * @return {@link #authoredOn} (The date (and perhaps time) when the prescription was initially written or authored on.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value + */ + public DateTimeType getAuthoredOnElement() { + if (this.authoredOn == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.authoredOn"); + else if (Configuration.doAutoCreate()) + this.authoredOn = new DateTimeType(); // bb + return this.authoredOn; + } + + public boolean hasAuthoredOnElement() { + return this.authoredOn != null && !this.authoredOn.isEmpty(); + } + + public boolean hasAuthoredOn() { + return this.authoredOn != null && !this.authoredOn.isEmpty(); + } + + /** + * @param value {@link #authoredOn} (The date (and perhaps time) when the prescription was initially written or authored on.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value + */ + public MedicationRequest setAuthoredOnElement(DateTimeType value) { + this.authoredOn = value; + return this; + } + + /** + * @return The date (and perhaps time) when the prescription was initially written or authored on. + */ + public Date getAuthoredOn() { + return this.authoredOn == null ? null : this.authoredOn.getValue(); + } + + /** + * @param value The date (and perhaps time) when the prescription was initially written or authored on. + */ + public MedicationRequest setAuthoredOn(Date value) { + if (value == null) + this.authoredOn = null; + else { if (this.authoredOn == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.authoredOn"); - else if (Configuration.doAutoCreate()) - this.authoredOn = new DateTimeType(); // bb - return this.authoredOn; + this.authoredOn = new DateTimeType(); + this.authoredOn.setValue(value); } + return this; + } - public boolean hasAuthoredOnElement() { - return this.authoredOn != null && !this.authoredOn.isEmpty(); - } + /** + * @return {@link #requester} (The individual, organization, or device that initiated the request and has responsibility for its activation.) + */ + public Reference getRequester() { + if (this.requester == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.requester"); + else if (Configuration.doAutoCreate()) + this.requester = new Reference(); // cc + return this.requester; + } - public boolean hasAuthoredOn() { - return this.authoredOn != null && !this.authoredOn.isEmpty(); - } + public boolean hasRequester() { + return this.requester != null && !this.requester.isEmpty(); + } - /** - * @param value {@link #authoredOn} (The date (and perhaps time) when the prescription was initially written or authored on.). This is the underlying object with id, value and extensions. The accessor "getAuthoredOn" gives direct access to the value - */ - public MedicationRequest setAuthoredOnElement(DateTimeType value) { - this.authoredOn = value; - return this; - } + /** + * @param value {@link #requester} (The individual, organization, or device that initiated the request and has responsibility for its activation.) + */ + public MedicationRequest setRequester(Reference value) { + this.requester = value; + return this; + } - /** - * @return The date (and perhaps time) when the prescription was initially written or authored on. - */ - public Date getAuthoredOn() { - return this.authoredOn == null ? null : this.authoredOn.getValue(); - } + /** + * @return {@link #requester} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The individual, organization, or device that initiated the request and has responsibility for its activation.) + */ + public Resource getRequesterTarget() { + return this.requesterTarget; + } - /** - * @param value The date (and perhaps time) when the prescription was initially written or authored on. - */ - public MedicationRequest setAuthoredOn(Date value) { - if (value == null) - this.authoredOn = null; - else { - if (this.authoredOn == null) - this.authoredOn = new DateTimeType(); - this.authoredOn.setValue(value); - } - return this; - } + /** + * @param value {@link #requester} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The individual, organization, or device that initiated the request and has responsibility for its activation.) + */ + public MedicationRequest setRequesterTarget(Resource value) { + this.requesterTarget = value; + return this; + } - /** - * @return {@link #requester} (The individual, organization, or device that initiated the request and has responsibility for its activation.) - */ - public Reference getRequester() { - if (this.requester == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.requester"); - else if (Configuration.doAutoCreate()) - this.requester = new Reference(); // cc - return this.requester; - } + /** + * @return {@link #performer} (The specified desired performer of the medication treatment (e.g. the performer of the medication administration).) + */ + public Reference getPerformer() { + if (this.performer == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.performer"); + else if (Configuration.doAutoCreate()) + this.performer = new Reference(); // cc + return this.performer; + } - public boolean hasRequester() { - return this.requester != null && !this.requester.isEmpty(); - } + public boolean hasPerformer() { + return this.performer != null && !this.performer.isEmpty(); + } - /** - * @param value {@link #requester} (The individual, organization, or device that initiated the request and has responsibility for its activation.) - */ - public MedicationRequest setRequester(Reference value) { - this.requester = value; - return this; - } + /** + * @param value {@link #performer} (The specified desired performer of the medication treatment (e.g. the performer of the medication administration).) + */ + public MedicationRequest setPerformer(Reference value) { + this.performer = value; + return this; + } - /** - * @return {@link #requester} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The individual, organization, or device that initiated the request and has responsibility for its activation.) - */ - public Resource getRequesterTarget() { - return this.requesterTarget; - } + /** + * @return {@link #performer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The specified desired performer of the medication treatment (e.g. the performer of the medication administration).) + */ + public Resource getPerformerTarget() { + return this.performerTarget; + } - /** - * @param value {@link #requester} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The individual, organization, or device that initiated the request and has responsibility for its activation.) - */ - public MedicationRequest setRequesterTarget(Resource value) { - this.requesterTarget = value; - return this; - } + /** + * @param value {@link #performer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The specified desired performer of the medication treatment (e.g. the performer of the medication administration).) + */ + public MedicationRequest setPerformerTarget(Resource value) { + this.performerTarget = value; + return this; + } - /** - * @return {@link #performer} (The specified desired performer of the medication treatment (e.g. the performer of the medication administration).) - */ - public Reference getPerformer() { - if (this.performer == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.performer"); - else if (Configuration.doAutoCreate()) - this.performer = new Reference(); // cc - return this.performer; - } + /** + * @return {@link #performerType} (Indicates the type of performer of the administration of the medication.) + */ + public CodeableConcept getPerformerType() { + if (this.performerType == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.performerType"); + else if (Configuration.doAutoCreate()) + this.performerType = new CodeableConcept(); // cc + return this.performerType; + } - public boolean hasPerformer() { - return this.performer != null && !this.performer.isEmpty(); - } + public boolean hasPerformerType() { + return this.performerType != null && !this.performerType.isEmpty(); + } - /** - * @param value {@link #performer} (The specified desired performer of the medication treatment (e.g. the performer of the medication administration).) - */ - public MedicationRequest setPerformer(Reference value) { - this.performer = value; - return this; - } + /** + * @param value {@link #performerType} (Indicates the type of performer of the administration of the medication.) + */ + public MedicationRequest setPerformerType(CodeableConcept value) { + this.performerType = value; + return this; + } - /** - * @return {@link #performer} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The specified desired performer of the medication treatment (e.g. the performer of the medication administration).) - */ - public Resource getPerformerTarget() { - return this.performerTarget; - } + /** + * @return {@link #recorder} (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.) + */ + public Reference getRecorder() { + if (this.recorder == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.recorder"); + else if (Configuration.doAutoCreate()) + this.recorder = new Reference(); // cc + return this.recorder; + } - /** - * @param value {@link #performer} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The specified desired performer of the medication treatment (e.g. the performer of the medication administration).) - */ - public MedicationRequest setPerformerTarget(Resource value) { - this.performerTarget = value; - return this; - } + public boolean hasRecorder() { + return this.recorder != null && !this.recorder.isEmpty(); + } - /** - * @return {@link #performerType} (Indicates the type of performer of the administration of the medication.) - */ - public CodeableConcept getPerformerType() { - if (this.performerType == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.performerType"); - else if (Configuration.doAutoCreate()) - this.performerType = new CodeableConcept(); // cc - return this.performerType; - } + /** + * @param value {@link #recorder} (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.) + */ + public MedicationRequest setRecorder(Reference value) { + this.recorder = value; + return this; + } - public boolean hasPerformerType() { - return this.performerType != null && !this.performerType.isEmpty(); - } + /** + * @return {@link #recorder} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.) + */ + public Resource getRecorderTarget() { + return this.recorderTarget; + } - /** - * @param value {@link #performerType} (Indicates the type of performer of the administration of the medication.) - */ - public MedicationRequest setPerformerType(CodeableConcept value) { - this.performerType = value; - return this; - } + /** + * @param value {@link #recorder} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.) + */ + public MedicationRequest setRecorderTarget(Resource value) { + this.recorderTarget = value; + return this; + } - /** - * @return {@link #recorder} (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.) - */ - public Reference getRecorder() { - if (this.recorder == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.recorder"); - else if (Configuration.doAutoCreate()) - this.recorder = new Reference(); // cc - return this.recorder; - } + /** + * @return {@link #reasonCode} (The reason or the indication for ordering or not ordering the medication.) + */ + public List getReasonCode() { + if (this.reasonCode == null) + this.reasonCode = new ArrayList(); + return this.reasonCode; + } - public boolean hasRecorder() { - return this.recorder != null && !this.recorder.isEmpty(); - } + /** + * @return Returns a reference to this for easy method chaining + */ + public MedicationRequest setReasonCode(List theReasonCode) { + this.reasonCode = theReasonCode; + return this; + } - /** - * @param value {@link #recorder} (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.) - */ - public MedicationRequest setRecorder(Reference value) { - this.recorder = value; - return this; - } - - /** - * @return {@link #recorder} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.) - */ - public Resource getRecorderTarget() { - return this.recorderTarget; - } - - /** - * @param value {@link #recorder} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.) - */ - public MedicationRequest setRecorderTarget(Resource value) { - this.recorderTarget = value; - return this; - } - - /** - * @return {@link #reasonCode} (The reason or the indication for ordering or not ordering the medication.) - */ - public List getReasonCode() { - if (this.reasonCode == null) - this.reasonCode = new ArrayList(); - return this.reasonCode; - } - - /** - * @return Returns a reference to this for easy method chaining - */ - public MedicationRequest setReasonCode(List theReasonCode) { - this.reasonCode = theReasonCode; - return this; - } - - public boolean hasReasonCode() { - if (this.reasonCode == null) - return false; - for (CodeableConcept item : this.reasonCode) - if (!item.isEmpty()) - return true; + public boolean hasReasonCode() { + if (this.reasonCode == null) return false; - } + for (CodeableConcept item : this.reasonCode) + if (!item.isEmpty()) + return true; + return false; + } - public CodeableConcept addReasonCode() { //3 - CodeableConcept t = new CodeableConcept(); - if (this.reasonCode == null) - this.reasonCode = new ArrayList(); - this.reasonCode.add(t); - return t; - } + public CodeableConcept addReasonCode() { //3 + CodeableConcept t = new CodeableConcept(); + if (this.reasonCode == null) + this.reasonCode = new ArrayList(); + this.reasonCode.add(t); + return t; + } - public MedicationRequest addReasonCode(CodeableConcept t) { //3 - if (t == null) - return this; - if (this.reasonCode == null) - this.reasonCode = new ArrayList(); - this.reasonCode.add(t); + public MedicationRequest addReasonCode(CodeableConcept t) { //3 + if (t == null) return this; - } + if (this.reasonCode == null) + this.reasonCode = new ArrayList(); + this.reasonCode.add(t); + return this; + } - /** - * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist - */ - public CodeableConcept getReasonCodeFirstRep() { - if (getReasonCode().isEmpty()) { - addReasonCode(); - } - return getReasonCode().get(0); + /** + * @return The first repetition of repeating field {@link #reasonCode}, creating it if it does not already exist + */ + public CodeableConcept getReasonCodeFirstRep() { + if (getReasonCode().isEmpty()) { + addReasonCode(); } + return getReasonCode().get(0); + } - /** - * @return {@link #reasonReference} (Condition or observation that supports why the medication was ordered.) - */ - public List getReasonReference() { - if (this.reasonReference == null) - this.reasonReference = new ArrayList(); - return this.reasonReference; - } + /** + * @return {@link #reasonReference} (Condition or observation that supports why the medication was ordered.) + */ + public List getReasonReference() { + if (this.reasonReference == null) + this.reasonReference = new ArrayList(); + return this.reasonReference; + } - /** - * @return Returns a reference to this for easy method chaining - */ - public MedicationRequest setReasonReference(List theReasonReference) { - this.reasonReference = theReasonReference; - return this; - } + /** + * @return Returns a reference to this for easy method chaining + */ + public MedicationRequest setReasonReference(List theReasonReference) { + this.reasonReference = theReasonReference; + return this; + } - public boolean hasReasonReference() { - if (this.reasonReference == null) - return false; - for (Reference item : this.reasonReference) - if (!item.isEmpty()) - return true; + public boolean hasReasonReference() { + if (this.reasonReference == null) return false; - } + for (Reference item : this.reasonReference) + if (!item.isEmpty()) + return true; + return false; + } - public Reference addReasonReference() { //3 - Reference t = new Reference(); - if (this.reasonReference == null) - this.reasonReference = new ArrayList(); - this.reasonReference.add(t); - return t; - } + public Reference addReasonReference() { //3 + Reference t = new Reference(); + if (this.reasonReference == null) + this.reasonReference = new ArrayList(); + this.reasonReference.add(t); + return t; + } - public MedicationRequest addReasonReference(Reference t) { //3 - if (t == null) - return this; - if (this.reasonReference == null) - this.reasonReference = new ArrayList(); - this.reasonReference.add(t); + public MedicationRequest addReasonReference(Reference t) { //3 + if (t == null) return this; - } + if (this.reasonReference == null) + this.reasonReference = new ArrayList(); + this.reasonReference.add(t); + return this; + } - /** - * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist - */ - public Reference getReasonReferenceFirstRep() { - if (getReasonReference().isEmpty()) { - addReasonReference(); - } - return getReasonReference().get(0); + /** + * @return The first repetition of repeating field {@link #reasonReference}, creating it if it does not already exist + */ + public Reference getReasonReferenceFirstRep() { + if (getReasonReference().isEmpty()) { + addReasonReference(); } + return getReasonReference().get(0); + } - /** - * @deprecated Use Reference#setResource(IBaseResource) instead - */ - @Deprecated - public List getReasonReferenceTarget() { - if (this.reasonReferenceTarget == null) - this.reasonReferenceTarget = new ArrayList(); - return this.reasonReferenceTarget; - } + /** + * @deprecated Use Reference#setResource(IBaseResource) instead + */ + @Deprecated + public List getReasonReferenceTarget() { + if (this.reasonReferenceTarget == null) + this.reasonReferenceTarget = new ArrayList(); + return this.reasonReferenceTarget; + } - /** - * @return {@link #instantiatesCanonical} (The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.) - */ - public List getInstantiatesCanonical() { - if (this.instantiatesCanonical == null) - this.instantiatesCanonical = new ArrayList(); - return this.instantiatesCanonical; - } + /** + * @return {@link #instantiatesCanonical} (The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.) + */ + public List getInstantiatesCanonical() { + if (this.instantiatesCanonical == null) + this.instantiatesCanonical = new ArrayList(); + return this.instantiatesCanonical; + } - /** - * @return Returns a reference to this for easy method chaining - */ - public MedicationRequest setInstantiatesCanonical(List theInstantiatesCanonical) { - this.instantiatesCanonical = theInstantiatesCanonical; - return this; - } + /** + * @return Returns a reference to this for easy method chaining + */ + public MedicationRequest setInstantiatesCanonical(List theInstantiatesCanonical) { + this.instantiatesCanonical = theInstantiatesCanonical; + return this; + } - public boolean hasInstantiatesCanonical() { - if (this.instantiatesCanonical == null) - return false; - for (CanonicalType item : this.instantiatesCanonical) - if (!item.isEmpty()) - return true; + public boolean hasInstantiatesCanonical() { + if (this.instantiatesCanonical == null) return false; - } + for (CanonicalType item : this.instantiatesCanonical) + if (!item.isEmpty()) + return true; + return false; + } - /** - * @return {@link #instantiatesCanonical} (The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.) - */ - public CanonicalType addInstantiatesCanonicalElement() {//2 - CanonicalType t = new CanonicalType(); - if (this.instantiatesCanonical == null) - this.instantiatesCanonical = new ArrayList(); - this.instantiatesCanonical.add(t); - return t; - } + /** + * @return {@link #instantiatesCanonical} (The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.) + */ + public CanonicalType addInstantiatesCanonicalElement() {//2 + CanonicalType t = new CanonicalType(); + if (this.instantiatesCanonical == null) + this.instantiatesCanonical = new ArrayList(); + this.instantiatesCanonical.add(t); + return t; + } - /** - * @param value {@link #instantiatesCanonical} (The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.) - */ - public MedicationRequest addInstantiatesCanonical(String value) { //1 - CanonicalType t = new CanonicalType(); - t.setValue(value); - if (this.instantiatesCanonical == null) - this.instantiatesCanonical = new ArrayList(); - this.instantiatesCanonical.add(t); - return this; - } + /** + * @param value {@link #instantiatesCanonical} (The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.) + */ + public MedicationRequest addInstantiatesCanonical(String value) { //1 + CanonicalType t = new CanonicalType(); + t.setValue(value); + if (this.instantiatesCanonical == null) + this.instantiatesCanonical = new ArrayList(); + this.instantiatesCanonical.add(t); + return this; + } - /** - * @param value {@link #instantiatesCanonical} (The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.) - */ - public boolean hasInstantiatesCanonical(String value) { - if (this.instantiatesCanonical == null) - return false; - for (CanonicalType v : this.instantiatesCanonical) - if (v.getValue().equals(value)) // canonical - return true; + /** + * @param value {@link #instantiatesCanonical} (The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.) + */ + public boolean hasInstantiatesCanonical(String value) { + if (this.instantiatesCanonical == null) return false; - } + for (CanonicalType v : this.instantiatesCanonical) + if (v.getValue().equals(value)) // canonical + return true; + return false; + } - /** - * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.) - */ - public List getInstantiatesUri() { - if (this.instantiatesUri == null) - this.instantiatesUri = new ArrayList(); - return this.instantiatesUri; - } + /** + * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.) + */ + public List getInstantiatesUri() { + if (this.instantiatesUri == null) + this.instantiatesUri = new ArrayList(); + return this.instantiatesUri; + } - /** - * @return Returns a reference to this for easy method chaining - */ - public MedicationRequest setInstantiatesUri(List theInstantiatesUri) { - this.instantiatesUri = theInstantiatesUri; - return this; - } + /** + * @return Returns a reference to this for easy method chaining + */ + public MedicationRequest setInstantiatesUri(List theInstantiatesUri) { + this.instantiatesUri = theInstantiatesUri; + return this; + } - public boolean hasInstantiatesUri() { - if (this.instantiatesUri == null) - return false; - for (UriType item : this.instantiatesUri) - if (!item.isEmpty()) - return true; + public boolean hasInstantiatesUri() { + if (this.instantiatesUri == null) return false; - } + for (UriType item : this.instantiatesUri) + if (!item.isEmpty()) + return true; + return false; + } - /** - * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.) - */ - public UriType addInstantiatesUriElement() {//2 - UriType t = new UriType(); - if (this.instantiatesUri == null) - this.instantiatesUri = new ArrayList(); - this.instantiatesUri.add(t); - return t; - } + /** + * @return {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.) + */ + public UriType addInstantiatesUriElement() {//2 + UriType t = new UriType(); + if (this.instantiatesUri == null) + this.instantiatesUri = new ArrayList(); + this.instantiatesUri.add(t); + return t; + } - /** - * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.) - */ - public MedicationRequest addInstantiatesUri(String value) { //1 - UriType t = new UriType(); - t.setValue(value); - if (this.instantiatesUri == null) - this.instantiatesUri = new ArrayList(); - this.instantiatesUri.add(t); - return this; - } + /** + * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.) + */ + public MedicationRequest addInstantiatesUri(String value) { //1 + UriType t = new UriType(); + t.setValue(value); + if (this.instantiatesUri == null) + this.instantiatesUri = new ArrayList(); + this.instantiatesUri.add(t); + return this; + } - /** - * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.) - */ - public boolean hasInstantiatesUri(String value) { - if (this.instantiatesUri == null) - return false; - for (UriType v : this.instantiatesUri) - if (v.getValue().equals(value)) // uri - return true; + /** + * @param value {@link #instantiatesUri} (The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.) + */ + public boolean hasInstantiatesUri(String value) { + if (this.instantiatesUri == null) return false; - } + for (UriType v : this.instantiatesUri) + if (v.getValue().equals(value)) // uri + return true; + return false; + } - /** - * @return {@link #basedOn} (A plan or request that is fulfilled in whole or in part by this medication request.) - */ - public List getBasedOn() { - if (this.basedOn == null) - this.basedOn = new ArrayList(); - return this.basedOn; - } + /** + * @return {@link #basedOn} (A plan or request that is fulfilled in whole or in part by this medication request.) + */ + public List getBasedOn() { + if (this.basedOn == null) + this.basedOn = new ArrayList(); + return this.basedOn; + } - /** - * @return Returns a reference to this for easy method chaining - */ - public MedicationRequest setBasedOn(List theBasedOn) { - this.basedOn = theBasedOn; - return this; - } + /** + * @return Returns a reference to this for easy method chaining + */ + public MedicationRequest setBasedOn(List theBasedOn) { + this.basedOn = theBasedOn; + return this; + } - public boolean hasBasedOn() { - if (this.basedOn == null) - return false; - for (Reference item : this.basedOn) - if (!item.isEmpty()) - return true; + public boolean hasBasedOn() { + if (this.basedOn == null) return false; - } + for (Reference item : this.basedOn) + if (!item.isEmpty()) + return true; + return false; + } - public Reference addBasedOn() { //3 - Reference t = new Reference(); - if (this.basedOn == null) - this.basedOn = new ArrayList(); - this.basedOn.add(t); - return t; - } + public Reference addBasedOn() { //3 + Reference t = new Reference(); + if (this.basedOn == null) + this.basedOn = new ArrayList(); + this.basedOn.add(t); + return t; + } - public MedicationRequest addBasedOn(Reference t) { //3 - if (t == null) - return this; - if (this.basedOn == null) - this.basedOn = new ArrayList(); - this.basedOn.add(t); + public MedicationRequest addBasedOn(Reference t) { //3 + if (t == null) return this; - } + if (this.basedOn == null) + this.basedOn = new ArrayList(); + this.basedOn.add(t); + return this; + } - /** - * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist - */ - public Reference getBasedOnFirstRep() { - if (getBasedOn().isEmpty()) { - addBasedOn(); - } - return getBasedOn().get(0); + /** + * @return The first repetition of repeating field {@link #basedOn}, creating it if it does not already exist + */ + public Reference getBasedOnFirstRep() { + if (getBasedOn().isEmpty()) { + addBasedOn(); } + return getBasedOn().get(0); + } - /** - * @deprecated Use Reference#setResource(IBaseResource) instead - */ - @Deprecated - public List getBasedOnTarget() { - if (this.basedOnTarget == null) - this.basedOnTarget = new ArrayList(); - return this.basedOnTarget; - } + /** + * @deprecated Use Reference#setResource(IBaseResource) instead + */ + @Deprecated + public List getBasedOnTarget() { + if (this.basedOnTarget == null) + this.basedOnTarget = new ArrayList(); + return this.basedOnTarget; + } - /** - * @return {@link #groupIdentifier} (A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.) - */ - public Identifier getGroupIdentifier() { - if (this.groupIdentifier == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.groupIdentifier"); - else if (Configuration.doAutoCreate()) - this.groupIdentifier = new Identifier(); // cc - return this.groupIdentifier; - } + /** + * @return {@link #groupIdentifier} (A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.) + */ + public Identifier getGroupIdentifier() { + if (this.groupIdentifier == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.groupIdentifier"); + else if (Configuration.doAutoCreate()) + this.groupIdentifier = new Identifier(); // cc + return this.groupIdentifier; + } - public boolean hasGroupIdentifier() { - return this.groupIdentifier != null && !this.groupIdentifier.isEmpty(); - } + public boolean hasGroupIdentifier() { + return this.groupIdentifier != null && !this.groupIdentifier.isEmpty(); + } - /** - * @param value {@link #groupIdentifier} (A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.) - */ - public MedicationRequest setGroupIdentifier(Identifier value) { - this.groupIdentifier = value; - return this; - } + /** + * @param value {@link #groupIdentifier} (A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.) + */ + public MedicationRequest setGroupIdentifier(Identifier value) { + this.groupIdentifier = value; + return this; + } - /** - * @return {@link #courseOfTherapyType} (The description of the overall patte3rn of the administration of the medication to the patient.) - */ - public CodeableConcept getCourseOfTherapyType() { - if (this.courseOfTherapyType == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.courseOfTherapyType"); - else if (Configuration.doAutoCreate()) - this.courseOfTherapyType = new CodeableConcept(); // cc - return this.courseOfTherapyType; - } + /** + * @return {@link #courseOfTherapyType} (The description of the overall patte3rn of the administration of the medication to the patient.) + */ + public CodeableConcept getCourseOfTherapyType() { + if (this.courseOfTherapyType == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.courseOfTherapyType"); + else if (Configuration.doAutoCreate()) + this.courseOfTherapyType = new CodeableConcept(); // cc + return this.courseOfTherapyType; + } - public boolean hasCourseOfTherapyType() { - return this.courseOfTherapyType != null && !this.courseOfTherapyType.isEmpty(); - } + public boolean hasCourseOfTherapyType() { + return this.courseOfTherapyType != null && !this.courseOfTherapyType.isEmpty(); + } - /** - * @param value {@link #courseOfTherapyType} (The description of the overall patte3rn of the administration of the medication to the patient.) - */ - public MedicationRequest setCourseOfTherapyType(CodeableConcept value) { - this.courseOfTherapyType = value; - return this; - } + /** + * @param value {@link #courseOfTherapyType} (The description of the overall patte3rn of the administration of the medication to the patient.) + */ + public MedicationRequest setCourseOfTherapyType(CodeableConcept value) { + this.courseOfTherapyType = value; + return this; + } - /** - * @return {@link #insurance} (Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.) - */ - public List getInsurance() { - if (this.insurance == null) - this.insurance = new ArrayList(); - return this.insurance; - } + /** + * @return {@link #insurance} (Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.) + */ + public List getInsurance() { + if (this.insurance == null) + this.insurance = new ArrayList(); + return this.insurance; + } - /** - * @return Returns a reference to this for easy method chaining - */ - public MedicationRequest setInsurance(List theInsurance) { - this.insurance = theInsurance; - return this; - } + /** + * @return Returns a reference to this for easy method chaining + */ + public MedicationRequest setInsurance(List theInsurance) { + this.insurance = theInsurance; + return this; + } - public boolean hasInsurance() { - if (this.insurance == null) - return false; - for (Reference item : this.insurance) - if (!item.isEmpty()) - return true; + public boolean hasInsurance() { + if (this.insurance == null) return false; - } + for (Reference item : this.insurance) + if (!item.isEmpty()) + return true; + return false; + } - public Reference addInsurance() { //3 - Reference t = new Reference(); - if (this.insurance == null) - this.insurance = new ArrayList(); - this.insurance.add(t); - return t; - } + public Reference addInsurance() { //3 + Reference t = new Reference(); + if (this.insurance == null) + this.insurance = new ArrayList(); + this.insurance.add(t); + return t; + } - public MedicationRequest addInsurance(Reference t) { //3 - if (t == null) - return this; - if (this.insurance == null) - this.insurance = new ArrayList(); - this.insurance.add(t); + public MedicationRequest addInsurance(Reference t) { //3 + if (t == null) return this; - } + if (this.insurance == null) + this.insurance = new ArrayList(); + this.insurance.add(t); + return this; + } - /** - * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist - */ - public Reference getInsuranceFirstRep() { - if (getInsurance().isEmpty()) { - addInsurance(); - } - return getInsurance().get(0); + /** + * @return The first repetition of repeating field {@link #insurance}, creating it if it does not already exist + */ + public Reference getInsuranceFirstRep() { + if (getInsurance().isEmpty()) { + addInsurance(); } + return getInsurance().get(0); + } - /** - * @deprecated Use Reference#setResource(IBaseResource) instead - */ - @Deprecated - public List getInsuranceTarget() { - if (this.insuranceTarget == null) - this.insuranceTarget = new ArrayList(); - return this.insuranceTarget; - } + /** + * @deprecated Use Reference#setResource(IBaseResource) instead + */ + @Deprecated + public List getInsuranceTarget() { + if (this.insuranceTarget == null) + this.insuranceTarget = new ArrayList(); + return this.insuranceTarget; + } - /** - * @return {@link #note} (Extra information about the prescription that could not be conveyed by the other attributes.) - */ - public List getNote() { - if (this.note == null) - this.note = new ArrayList(); - return this.note; - } + /** + * @return {@link #note} (Extra information about the prescription that could not be conveyed by the other attributes.) + */ + public List getNote() { + if (this.note == null) + this.note = new ArrayList(); + return this.note; + } - /** - * @return Returns a reference to this for easy method chaining - */ - public MedicationRequest setNote(List theNote) { - this.note = theNote; - return this; - } + /** + * @return Returns a reference to this for easy method chaining + */ + public MedicationRequest setNote(List theNote) { + this.note = theNote; + return this; + } - public boolean hasNote() { - if (this.note == null) - return false; - for (Annotation item : this.note) - if (!item.isEmpty()) - return true; + public boolean hasNote() { + if (this.note == null) return false; - } + for (Annotation item : this.note) + if (!item.isEmpty()) + return true; + return false; + } - public Annotation addNote() { //3 - Annotation t = new Annotation(); - if (this.note == null) - this.note = new ArrayList(); - this.note.add(t); - return t; - } + public Annotation addNote() { //3 + Annotation t = new Annotation(); + if (this.note == null) + this.note = new ArrayList(); + this.note.add(t); + return t; + } - public MedicationRequest addNote(Annotation t) { //3 - if (t == null) - return this; - if (this.note == null) - this.note = new ArrayList(); - this.note.add(t); + public MedicationRequest addNote(Annotation t) { //3 + if (t == null) return this; - } + if (this.note == null) + this.note = new ArrayList(); + this.note.add(t); + return this; + } - /** - * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist - */ - public Annotation getNoteFirstRep() { - if (getNote().isEmpty()) { - addNote(); - } - return getNote().get(0); + /** + * @return The first repetition of repeating field {@link #note}, creating it if it does not already exist + */ + public Annotation getNoteFirstRep() { + if (getNote().isEmpty()) { + addNote(); } + return getNote().get(0); + } - /** - * @return {@link #dosageInstruction} (Indicates how the medication is to be used by the patient.) - */ - public List getDosageInstruction() { - if (this.dosageInstruction == null) - this.dosageInstruction = new ArrayList(); - return this.dosageInstruction; - } + /** + * @return {@link #dosageInstruction} (Indicates how the medication is to be used by the patient.) + */ + public List getDosageInstruction() { + if (this.dosageInstruction == null) + this.dosageInstruction = new ArrayList(); + return this.dosageInstruction; + } - /** - * @return Returns a reference to this for easy method chaining - */ - public MedicationRequest setDosageInstruction(List theDosageInstruction) { - this.dosageInstruction = theDosageInstruction; - return this; - } + /** + * @return Returns a reference to this for easy method chaining + */ + public MedicationRequest setDosageInstruction(List theDosageInstruction) { + this.dosageInstruction = theDosageInstruction; + return this; + } - public boolean hasDosageInstruction() { - if (this.dosageInstruction == null) - return false; - for (Dosage item : this.dosageInstruction) - if (!item.isEmpty()) - return true; + public boolean hasDosageInstruction() { + if (this.dosageInstruction == null) return false; - } + for (Dosage item : this.dosageInstruction) + if (!item.isEmpty()) + return true; + return false; + } - public Dosage addDosageInstruction() { //3 - Dosage t = new Dosage(); - if (this.dosageInstruction == null) - this.dosageInstruction = new ArrayList(); - this.dosageInstruction.add(t); - return t; - } + public Dosage addDosageInstruction() { //3 + Dosage t = new Dosage(); + if (this.dosageInstruction == null) + this.dosageInstruction = new ArrayList(); + this.dosageInstruction.add(t); + return t; + } - public MedicationRequest addDosageInstruction(Dosage t) { //3 - if (t == null) - return this; - if (this.dosageInstruction == null) - this.dosageInstruction = new ArrayList(); - this.dosageInstruction.add(t); + public MedicationRequest addDosageInstruction(Dosage t) { //3 + if (t == null) return this; - } + if (this.dosageInstruction == null) + this.dosageInstruction = new ArrayList(); + this.dosageInstruction.add(t); + return this; + } - /** - * @return The first repetition of repeating field {@link #dosageInstruction}, creating it if it does not already exist - */ - public Dosage getDosageInstructionFirstRep() { - if (getDosageInstruction().isEmpty()) { - addDosageInstruction(); - } - return getDosageInstruction().get(0); + /** + * @return The first repetition of repeating field {@link #dosageInstruction}, creating it if it does not already exist + */ + public Dosage getDosageInstructionFirstRep() { + if (getDosageInstruction().isEmpty()) { + addDosageInstruction(); } + return getDosageInstruction().get(0); + } - /** - * @return {@link #dispenseRequest} (Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.) - */ - public MedicationRequestDispenseRequestComponent getDispenseRequest() { - if (this.dispenseRequest == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.dispenseRequest"); - else if (Configuration.doAutoCreate()) - this.dispenseRequest = new MedicationRequestDispenseRequestComponent(); // cc - return this.dispenseRequest; - } + /** + * @return {@link #dispenseRequest} (Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.) + */ + public MedicationRequestDispenseRequestComponent getDispenseRequest() { + if (this.dispenseRequest == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.dispenseRequest"); + else if (Configuration.doAutoCreate()) + this.dispenseRequest = new MedicationRequestDispenseRequestComponent(); // cc + return this.dispenseRequest; + } - public boolean hasDispenseRequest() { - return this.dispenseRequest != null && !this.dispenseRequest.isEmpty(); - } + public boolean hasDispenseRequest() { + return this.dispenseRequest != null && !this.dispenseRequest.isEmpty(); + } - /** - * @param value {@link #dispenseRequest} (Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.) - */ - public MedicationRequest setDispenseRequest(MedicationRequestDispenseRequestComponent value) { - this.dispenseRequest = value; - return this; - } + /** + * @param value {@link #dispenseRequest} (Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.) + */ + public MedicationRequest setDispenseRequest(MedicationRequestDispenseRequestComponent value) { + this.dispenseRequest = value; + return this; + } - /** - * @return {@link #substitution} (Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.) - */ - public MedicationRequestSubstitutionComponent getSubstitution() { - if (this.substitution == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.substitution"); - else if (Configuration.doAutoCreate()) - this.substitution = new MedicationRequestSubstitutionComponent(); // cc - return this.substitution; - } + /** + * @return {@link #substitution} (Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.) + */ + public MedicationRequestSubstitutionComponent getSubstitution() { + if (this.substitution == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.substitution"); + else if (Configuration.doAutoCreate()) + this.substitution = new MedicationRequestSubstitutionComponent(); // cc + return this.substitution; + } - public boolean hasSubstitution() { - return this.substitution != null && !this.substitution.isEmpty(); - } + public boolean hasSubstitution() { + return this.substitution != null && !this.substitution.isEmpty(); + } - /** - * @param value {@link #substitution} (Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.) - */ - public MedicationRequest setSubstitution(MedicationRequestSubstitutionComponent value) { - this.substitution = value; - return this; - } + /** + * @param value {@link #substitution} (Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.) + */ + public MedicationRequest setSubstitution(MedicationRequestSubstitutionComponent value) { + this.substitution = value; + return this; + } - /** - * @return {@link #priorPrescription} (A link to a resource representing an earlier order related order or prescription.) - */ - public Reference getPriorPrescription() { - if (this.priorPrescription == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.priorPrescription"); - else if (Configuration.doAutoCreate()) - this.priorPrescription = new Reference(); // cc - return this.priorPrescription; - } + /** + * @return {@link #priorPrescription} (A link to a resource representing an earlier order related order or prescription.) + */ + public Reference getPriorPrescription() { + if (this.priorPrescription == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.priorPrescription"); + else if (Configuration.doAutoCreate()) + this.priorPrescription = new Reference(); // cc + return this.priorPrescription; + } - public boolean hasPriorPrescription() { - return this.priorPrescription != null && !this.priorPrescription.isEmpty(); - } + public boolean hasPriorPrescription() { + return this.priorPrescription != null && !this.priorPrescription.isEmpty(); + } - /** - * @param value {@link #priorPrescription} (A link to a resource representing an earlier order related order or prescription.) - */ - public MedicationRequest setPriorPrescription(Reference value) { - this.priorPrescription = value; - return this; - } + /** + * @param value {@link #priorPrescription} (A link to a resource representing an earlier order related order or prescription.) + */ + public MedicationRequest setPriorPrescription(Reference value) { + this.priorPrescription = value; + return this; + } - /** - * @return {@link #priorPrescription} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A link to a resource representing an earlier order related order or prescription.) - */ - public MedicationRequest getPriorPrescriptionTarget() { - if (this.priorPrescriptionTarget == null) - if (Configuration.errorOnAutoCreate()) - throw new Error("Attempt to auto-create MedicationRequest.priorPrescription"); - else if (Configuration.doAutoCreate()) - this.priorPrescriptionTarget = new MedicationRequest(); // aa - return this.priorPrescriptionTarget; - } + /** + * @return {@link #priorPrescription} The actual object that is the target of the reference. The reference library doesn't populate this, but you can use it to hold the resource if you resolve it. (A link to a resource representing an earlier order related order or prescription.) + */ + public MedicationRequest getPriorPrescriptionTarget() { + if (this.priorPrescriptionTarget == null) + if (Configuration.errorOnAutoCreate()) + throw new Error("Attempt to auto-create MedicationRequest.priorPrescription"); + else if (Configuration.doAutoCreate()) + this.priorPrescriptionTarget = new MedicationRequest(); // aa + return this.priorPrescriptionTarget; + } - /** - * @param value {@link #priorPrescription} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A link to a resource representing an earlier order related order or prescription.) - */ - public MedicationRequest setPriorPrescriptionTarget(MedicationRequest value) { - this.priorPrescriptionTarget = value; - return this; - } + /** + * @param value {@link #priorPrescription} The actual object that is the target of the reference. The reference library doesn't use these, but you can use it to hold the resource if you resolve it. (A link to a resource representing an earlier order related order or prescription.) + */ + public MedicationRequest setPriorPrescriptionTarget(MedicationRequest value) { + this.priorPrescriptionTarget = value; + return this; + } - /** - * @return {@link #detectedIssue} (Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc.) - */ - public List getDetectedIssue() { - if (this.detectedIssue == null) - this.detectedIssue = new ArrayList(); - return this.detectedIssue; - } + /** + * @return {@link #detectedIssue} (Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc.) + */ + public List getDetectedIssue() { + if (this.detectedIssue == null) + this.detectedIssue = new ArrayList(); + return this.detectedIssue; + } - /** - * @return Returns a reference to this for easy method chaining - */ - public MedicationRequest setDetectedIssue(List theDetectedIssue) { - this.detectedIssue = theDetectedIssue; - return this; - } + /** + * @return Returns a reference to this for easy method chaining + */ + public MedicationRequest setDetectedIssue(List theDetectedIssue) { + this.detectedIssue = theDetectedIssue; + return this; + } - public boolean hasDetectedIssue() { - if (this.detectedIssue == null) - return false; - for (Reference item : this.detectedIssue) - if (!item.isEmpty()) - return true; + public boolean hasDetectedIssue() { + if (this.detectedIssue == null) return false; - } + for (Reference item : this.detectedIssue) + if (!item.isEmpty()) + return true; + return false; + } - public Reference addDetectedIssue() { //3 - Reference t = new Reference(); - if (this.detectedIssue == null) - this.detectedIssue = new ArrayList(); - this.detectedIssue.add(t); - return t; - } + public Reference addDetectedIssue() { //3 + Reference t = new Reference(); + if (this.detectedIssue == null) + this.detectedIssue = new ArrayList(); + this.detectedIssue.add(t); + return t; + } - public MedicationRequest addDetectedIssue(Reference t) { //3 - if (t == null) - return this; - if (this.detectedIssue == null) - this.detectedIssue = new ArrayList(); - this.detectedIssue.add(t); + public MedicationRequest addDetectedIssue(Reference t) { //3 + if (t == null) return this; - } + if (this.detectedIssue == null) + this.detectedIssue = new ArrayList(); + this.detectedIssue.add(t); + return this; + } - /** - * @return The first repetition of repeating field {@link #detectedIssue}, creating it if it does not already exist - */ - public Reference getDetectedIssueFirstRep() { - if (getDetectedIssue().isEmpty()) { - addDetectedIssue(); - } - return getDetectedIssue().get(0); + /** + * @return The first repetition of repeating field {@link #detectedIssue}, creating it if it does not already exist + */ + public Reference getDetectedIssueFirstRep() { + if (getDetectedIssue().isEmpty()) { + addDetectedIssue(); } + return getDetectedIssue().get(0); + } - /** - * @deprecated Use Reference#setResource(IBaseResource) instead - */ - @Deprecated - public List getDetectedIssueTarget() { - if (this.detectedIssueTarget == null) - this.detectedIssueTarget = new ArrayList(); - return this.detectedIssueTarget; - } + /** + * @deprecated Use Reference#setResource(IBaseResource) instead + */ + @Deprecated + public List getDetectedIssueTarget() { + if (this.detectedIssueTarget == null) + this.detectedIssueTarget = new ArrayList(); + return this.detectedIssueTarget; + } - /** - * @deprecated Use Reference#setResource(IBaseResource) instead - */ - @Deprecated - public DetectedIssue addDetectedIssueTarget() { - DetectedIssue r = new DetectedIssue(); - if (this.detectedIssueTarget == null) - this.detectedIssueTarget = new ArrayList(); - this.detectedIssueTarget.add(r); - return r; - } + /** + * @deprecated Use Reference#setResource(IBaseResource) instead + */ + @Deprecated + public DetectedIssue addDetectedIssueTarget() { + DetectedIssue r = new DetectedIssue(); + if (this.detectedIssueTarget == null) + this.detectedIssueTarget = new ArrayList(); + this.detectedIssueTarget.add(r); + return r; + } - /** - * @return {@link #eventHistory} (Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.) - */ - public List getEventHistory() { - if (this.eventHistory == null) - this.eventHistory = new ArrayList(); - return this.eventHistory; - } + /** + * @return {@link #eventHistory} (Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.) + */ + public List getEventHistory() { + if (this.eventHistory == null) + this.eventHistory = new ArrayList(); + return this.eventHistory; + } - /** - * @return Returns a reference to this for easy method chaining - */ - public MedicationRequest setEventHistory(List theEventHistory) { - this.eventHistory = theEventHistory; - return this; - } + /** + * @return Returns a reference to this for easy method chaining + */ + public MedicationRequest setEventHistory(List theEventHistory) { + this.eventHistory = theEventHistory; + return this; + } - public boolean hasEventHistory() { - if (this.eventHistory == null) - return false; - for (Reference item : this.eventHistory) - if (!item.isEmpty()) - return true; + public boolean hasEventHistory() { + if (this.eventHistory == null) return false; - } + for (Reference item : this.eventHistory) + if (!item.isEmpty()) + return true; + return false; + } - public Reference addEventHistory() { //3 - Reference t = new Reference(); - if (this.eventHistory == null) - this.eventHistory = new ArrayList(); - this.eventHistory.add(t); - return t; - } + public Reference addEventHistory() { //3 + Reference t = new Reference(); + if (this.eventHistory == null) + this.eventHistory = new ArrayList(); + this.eventHistory.add(t); + return t; + } - public MedicationRequest addEventHistory(Reference t) { //3 - if (t == null) - return this; - if (this.eventHistory == null) - this.eventHistory = new ArrayList(); - this.eventHistory.add(t); + public MedicationRequest addEventHistory(Reference t) { //3 + if (t == null) return this; + if (this.eventHistory == null) + this.eventHistory = new ArrayList(); + this.eventHistory.add(t); + return this; + } + + /** + * @return The first repetition of repeating field {@link #eventHistory}, creating it if it does not already exist + */ + public Reference getEventHistoryFirstRep() { + if (getEventHistory().isEmpty()) { + addEventHistory(); + } + return getEventHistory().get(0); + } + + /** + * @deprecated Use Reference#setResource(IBaseResource) instead + */ + @Deprecated + public List getEventHistoryTarget() { + if (this.eventHistoryTarget == null) + this.eventHistoryTarget = new ArrayList(); + return this.eventHistoryTarget; + } + + /** + * @deprecated Use Reference#setResource(IBaseResource) instead + */ + @Deprecated + public Provenance addEventHistoryTarget() { + Provenance r = new Provenance(); + if (this.eventHistoryTarget == null) + this.eventHistoryTarget = new ArrayList(); + this.eventHistoryTarget.add(r); + return r; + } + + protected void listChildren(List children) { + super.listChildren(children); + children.add(new Property("identifier", "Identifier", "Identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier)); + children.add(new Property("status", "code", "A code specifying the current state of the order. Generally, this will be active or completed state.", 0, 1, status)); + children.add(new Property("statusReason", "CodeableConcept", "Captures the reason for the current state of the MedicationRequest.", 0, 1, statusReason)); + children.add(new Property("intent", "code", "Whether the request is a proposal, plan, or an original order.", 0, 1, intent)); + children.add(new Property("category", "CodeableConcept", "Indicates the type of medication request (for example, where the medication is expected to be consumed or administered (i.e. inpatient or outpatient)).", 0, java.lang.Integer.MAX_VALUE, category)); + children.add(new Property("priority", "code", "Indicates how quickly the Medication Request should be addressed with respect to other requests.", 0, 1, priority)); + children.add(new Property("doNotPerform", "boolean", "If true indicates that the provider is asking for the medication request not to occur.", 0, 1, doNotPerform)); + children.add(new Property("reported[x]", "boolean|Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.", 0, 1, reported)); + children.add(new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication)); + children.add(new Property("subject", "Reference(Patient|Group)", "A link to a resource representing the person or set of individuals to whom the medication will be given.", 0, 1, subject)); + children.add(new Property("encounter", "Reference(Encounter)", "The Encounter during which this [x] was created or to which the creation of this record is tightly associated.", 0, 1, encounter)); + children.add(new Property("supportingInformation", "Reference(Any)", "Include additional information (for example, patient height and weight) that supports the ordering of the medication.", 0, java.lang.Integer.MAX_VALUE, supportingInformation)); + children.add(new Property("authoredOn", "dateTime", "The date (and perhaps time) when the prescription was initially written or authored on.", 0, 1, authoredOn)); + children.add(new Property("requester", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson|Device)", "The individual, organization, or device that initiated the request and has responsibility for its activation.", 0, 1, requester)); + children.add(new Property("performer", "Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson|CareTeam)", "The specified desired performer of the medication treatment (e.g. the performer of the medication administration).", 0, 1, performer)); + children.add(new Property("performerType", "CodeableConcept", "Indicates the type of performer of the administration of the medication.", 0, 1, performerType)); + children.add(new Property("recorder", "Reference(Practitioner|PractitionerRole)", "The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.", 0, 1, recorder)); + children.add(new Property("reasonCode", "CodeableConcept", "The reason or the indication for ordering or not ordering the medication.", 0, java.lang.Integer.MAX_VALUE, reasonCode)); + children.add(new Property("reasonReference", "Reference(Condition|Observation)", "Condition or observation that supports why the medication was ordered.", 0, java.lang.Integer.MAX_VALUE, reasonReference)); + children.add(new Property("instantiatesCanonical", "canonical", "The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical)); + children.add(new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri)); + children.add(new Property("basedOn", "Reference(CarePlan|MedicationRequest|ServiceRequest|ImmunizationRecommendation)", "A plan or request that is fulfilled in whole or in part by this medication request.", 0, java.lang.Integer.MAX_VALUE, basedOn)); + children.add(new Property("groupIdentifier", "Identifier", "A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.", 0, 1, groupIdentifier)); + children.add(new Property("courseOfTherapyType", "CodeableConcept", "The description of the overall patte3rn of the administration of the medication to the patient.", 0, 1, courseOfTherapyType)); + children.add(new Property("insurance", "Reference(Coverage|ClaimResponse)", "Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.", 0, java.lang.Integer.MAX_VALUE, insurance)); + children.add(new Property("note", "Annotation", "Extra information about the prescription that could not be conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note)); + children.add(new Property("dosageInstruction", "Dosage", "Indicates how the medication is to be used by the patient.", 0, java.lang.Integer.MAX_VALUE, dosageInstruction)); + children.add(new Property("dispenseRequest", "", "Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.", 0, 1, dispenseRequest)); + children.add(new Property("substitution", "", "Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.", 0, 1, substitution)); + children.add(new Property("priorPrescription", "Reference(MedicationRequest)", "A link to a resource representing an earlier order related order or prescription.", 0, 1, priorPrescription)); + children.add(new Property("detectedIssue", "Reference(DetectedIssue)", "Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc.", 0, java.lang.Integer.MAX_VALUE, detectedIssue)); + children.add(new Property("eventHistory", "Reference(Provenance)", "Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.", 0, java.lang.Integer.MAX_VALUE, eventHistory)); + } + + @Override + public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { + switch (_hash) { + case -1618432855: /*identifier*/ + return new Property("identifier", "Identifier", "Identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier); + case -892481550: /*status*/ + return new Property("status", "code", "A code specifying the current state of the order. Generally, this will be active or completed state.", 0, 1, status); + case 2051346646: /*statusReason*/ + return new Property("statusReason", "CodeableConcept", "Captures the reason for the current state of the MedicationRequest.", 0, 1, statusReason); + case -1183762788: /*intent*/ + return new Property("intent", "code", "Whether the request is a proposal, plan, or an original order.", 0, 1, intent); + case 50511102: /*category*/ + return new Property("category", "CodeableConcept", "Indicates the type of medication request (for example, where the medication is expected to be consumed or administered (i.e. inpatient or outpatient)).", 0, java.lang.Integer.MAX_VALUE, category); + case -1165461084: /*priority*/ + return new Property("priority", "code", "Indicates how quickly the Medication Request should be addressed with respect to other requests.", 0, 1, priority); + case -1788508167: /*doNotPerform*/ + return new Property("doNotPerform", "boolean", "If true indicates that the provider is asking for the medication request not to occur.", 0, 1, doNotPerform); + case -241505587: /*reported[x]*/ + return new Property("reported[x]", "boolean|Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.", 0, 1, reported); + case -427039533: /*reported*/ + return new Property("reported[x]", "boolean|Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.", 0, 1, reported); + case 1219992533: /*reportedBoolean*/ + return new Property("reported[x]", "boolean|Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.", 0, 1, reported); + case 1198143416: /*reportedReference*/ + return new Property("reported[x]", "boolean|Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.", 0, 1, reported); + case 1458402129: /*medication[x]*/ + return new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication); + case 1998965455: /*medication*/ + return new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication); + case -209845038: /*medicationCodeableConcept*/ + return new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication); + case 2104315196: /*medicationReference*/ + return new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication); + case -1867885268: /*subject*/ + return new Property("subject", "Reference(Patient|Group)", "A link to a resource representing the person or set of individuals to whom the medication will be given.", 0, 1, subject); + case 1524132147: /*encounter*/ + return new Property("encounter", "Reference(Encounter)", "The Encounter during which this [x] was created or to which the creation of this record is tightly associated.", 0, 1, encounter); + case -1248768647: /*supportingInformation*/ + return new Property("supportingInformation", "Reference(Any)", "Include additional information (for example, patient height and weight) that supports the ordering of the medication.", 0, java.lang.Integer.MAX_VALUE, supportingInformation); + case -1500852503: /*authoredOn*/ + return new Property("authoredOn", "dateTime", "The date (and perhaps time) when the prescription was initially written or authored on.", 0, 1, authoredOn); + case 693933948: /*requester*/ + return new Property("requester", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson|Device)", "The individual, organization, or device that initiated the request and has responsibility for its activation.", 0, 1, requester); + case 481140686: /*performer*/ + return new Property("performer", "Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson|CareTeam)", "The specified desired performer of the medication treatment (e.g. the performer of the medication administration).", 0, 1, performer); + case -901444568: /*performerType*/ + return new Property("performerType", "CodeableConcept", "Indicates the type of performer of the administration of the medication.", 0, 1, performerType); + case -799233858: /*recorder*/ + return new Property("recorder", "Reference(Practitioner|PractitionerRole)", "The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.", 0, 1, recorder); + case 722137681: /*reasonCode*/ + return new Property("reasonCode", "CodeableConcept", "The reason or the indication for ordering or not ordering the medication.", 0, java.lang.Integer.MAX_VALUE, reasonCode); + case -1146218137: /*reasonReference*/ + return new Property("reasonReference", "Reference(Condition|Observation)", "Condition or observation that supports why the medication was ordered.", 0, java.lang.Integer.MAX_VALUE, reasonReference); + case 8911915: /*instantiatesCanonical*/ + return new Property("instantiatesCanonical", "canonical", "The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical); + case -1926393373: /*instantiatesUri*/ + return new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri); + case -332612366: /*basedOn*/ + return new Property("basedOn", "Reference(CarePlan|MedicationRequest|ServiceRequest|ImmunizationRecommendation)", "A plan or request that is fulfilled in whole or in part by this medication request.", 0, java.lang.Integer.MAX_VALUE, basedOn); + case -445338488: /*groupIdentifier*/ + return new Property("groupIdentifier", "Identifier", "A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.", 0, 1, groupIdentifier); + case -447282031: /*courseOfTherapyType*/ + return new Property("courseOfTherapyType", "CodeableConcept", "The description of the overall patte3rn of the administration of the medication to the patient.", 0, 1, courseOfTherapyType); + case 73049818: /*insurance*/ + return new Property("insurance", "Reference(Coverage|ClaimResponse)", "Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.", 0, java.lang.Integer.MAX_VALUE, insurance); + case 3387378: /*note*/ + return new Property("note", "Annotation", "Extra information about the prescription that could not be conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note); + case -1201373865: /*dosageInstruction*/ + return new Property("dosageInstruction", "Dosage", "Indicates how the medication is to be used by the patient.", 0, java.lang.Integer.MAX_VALUE, dosageInstruction); + case 824620658: /*dispenseRequest*/ + return new Property("dispenseRequest", "", "Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.", 0, 1, dispenseRequest); + case 826147581: /*substitution*/ + return new Property("substitution", "", "Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.", 0, 1, substitution); + case -486355964: /*priorPrescription*/ + return new Property("priorPrescription", "Reference(MedicationRequest)", "A link to a resource representing an earlier order related order or prescription.", 0, 1, priorPrescription); + case 51602295: /*detectedIssue*/ + return new Property("detectedIssue", "Reference(DetectedIssue)", "Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc.", 0, java.lang.Integer.MAX_VALUE, detectedIssue); + case 1835190426: /*eventHistory*/ + return new Property("eventHistory", "Reference(Provenance)", "Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.", 0, java.lang.Integer.MAX_VALUE, eventHistory); + default: + return super.getNamedProperty(_hash, _name, _checkValid); } - /** - * @return The first repetition of repeating field {@link #eventHistory}, creating it if it does not already exist - */ - public Reference getEventHistoryFirstRep() { - if (getEventHistory().isEmpty()) { - addEventHistory(); - } - return getEventHistory().get(0); + } + + @Override + public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { + switch (hash) { + case -1618432855: /*identifier*/ + return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier + case -892481550: /*status*/ + return this.status == null ? new Base[0] : new Base[]{this.status}; // Enumeration + case 2051346646: /*statusReason*/ + return this.statusReason == null ? new Base[0] : new Base[]{this.statusReason}; // CodeableConcept + case -1183762788: /*intent*/ + return this.intent == null ? new Base[0] : new Base[]{this.intent}; // Enumeration + case 50511102: /*category*/ + return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept + case -1165461084: /*priority*/ + return this.priority == null ? new Base[0] : new Base[]{this.priority}; // Enumeration + case -1788508167: /*doNotPerform*/ + return this.doNotPerform == null ? new Base[0] : new Base[]{this.doNotPerform}; // BooleanType + case -427039533: /*reported*/ + return this.reported == null ? new Base[0] : new Base[]{this.reported}; // Type + case 1998965455: /*medication*/ + return this.medication == null ? new Base[0] : new Base[]{this.medication}; // Type + case -1867885268: /*subject*/ + return this.subject == null ? new Base[0] : new Base[]{this.subject}; // Reference + case 1524132147: /*encounter*/ + return this.encounter == null ? new Base[0] : new Base[]{this.encounter}; // Reference + case -1248768647: /*supportingInformation*/ + return this.supportingInformation == null ? new Base[0] : this.supportingInformation.toArray(new Base[this.supportingInformation.size()]); // Reference + case -1500852503: /*authoredOn*/ + return this.authoredOn == null ? new Base[0] : new Base[]{this.authoredOn}; // DateTimeType + case 693933948: /*requester*/ + return this.requester == null ? new Base[0] : new Base[]{this.requester}; // Reference + case 481140686: /*performer*/ + return this.performer == null ? new Base[0] : new Base[]{this.performer}; // Reference + case -901444568: /*performerType*/ + return this.performerType == null ? new Base[0] : new Base[]{this.performerType}; // CodeableConcept + case -799233858: /*recorder*/ + return this.recorder == null ? new Base[0] : new Base[]{this.recorder}; // Reference + case 722137681: /*reasonCode*/ + return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept + case -1146218137: /*reasonReference*/ + return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference + case 8911915: /*instantiatesCanonical*/ + return this.instantiatesCanonical == null ? new Base[0] : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType + case -1926393373: /*instantiatesUri*/ + return this.instantiatesUri == null ? new Base[0] : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType + case -332612366: /*basedOn*/ + return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference + case -445338488: /*groupIdentifier*/ + return this.groupIdentifier == null ? new Base[0] : new Base[]{this.groupIdentifier}; // Identifier + case -447282031: /*courseOfTherapyType*/ + return this.courseOfTherapyType == null ? new Base[0] : new Base[]{this.courseOfTherapyType}; // CodeableConcept + case 73049818: /*insurance*/ + return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // Reference + case 3387378: /*note*/ + return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation + case -1201373865: /*dosageInstruction*/ + return this.dosageInstruction == null ? new Base[0] : this.dosageInstruction.toArray(new Base[this.dosageInstruction.size()]); // Dosage + case 824620658: /*dispenseRequest*/ + return this.dispenseRequest == null ? new Base[0] : new Base[]{this.dispenseRequest}; // MedicationRequestDispenseRequestComponent + case 826147581: /*substitution*/ + return this.substitution == null ? new Base[0] : new Base[]{this.substitution}; // MedicationRequestSubstitutionComponent + case -486355964: /*priorPrescription*/ + return this.priorPrescription == null ? new Base[0] : new Base[]{this.priorPrescription}; // Reference + case 51602295: /*detectedIssue*/ + return this.detectedIssue == null ? new Base[0] : this.detectedIssue.toArray(new Base[this.detectedIssue.size()]); // Reference + case 1835190426: /*eventHistory*/ + return this.eventHistory == null ? new Base[0] : this.eventHistory.toArray(new Base[this.eventHistory.size()]); // Reference + default: + return super.getProperty(hash, name, checkValid); } - /** - * @deprecated Use Reference#setResource(IBaseResource) instead - */ - @Deprecated - public List getEventHistoryTarget() { - if (this.eventHistoryTarget == null) - this.eventHistoryTarget = new ArrayList(); - return this.eventHistoryTarget; - } + } - /** - * @deprecated Use Reference#setResource(IBaseResource) instead - */ - @Deprecated - public Provenance addEventHistoryTarget() { - Provenance r = new Provenance(); - if (this.eventHistoryTarget == null) - this.eventHistoryTarget = new ArrayList(); - this.eventHistoryTarget.add(r); - return r; - } - - protected void listChildren(List children) { - super.listChildren(children); - children.add(new Property("identifier", "Identifier", "Identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier)); - children.add(new Property("status", "code", "A code specifying the current state of the order. Generally, this will be active or completed state.", 0, 1, status)); - children.add(new Property("statusReason", "CodeableConcept", "Captures the reason for the current state of the MedicationRequest.", 0, 1, statusReason)); - children.add(new Property("intent", "code", "Whether the request is a proposal, plan, or an original order.", 0, 1, intent)); - children.add(new Property("category", "CodeableConcept", "Indicates the type of medication request (for example, where the medication is expected to be consumed or administered (i.e. inpatient or outpatient)).", 0, java.lang.Integer.MAX_VALUE, category)); - children.add(new Property("priority", "code", "Indicates how quickly the Medication Request should be addressed with respect to other requests.", 0, 1, priority)); - children.add(new Property("doNotPerform", "boolean", "If true indicates that the provider is asking for the medication request not to occur.", 0, 1, doNotPerform)); - children.add(new Property("reported[x]", "boolean|Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.", 0, 1, reported)); - children.add(new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication)); - children.add(new Property("subject", "Reference(Patient|Group)", "A link to a resource representing the person or set of individuals to whom the medication will be given.", 0, 1, subject)); - children.add(new Property("encounter", "Reference(Encounter)", "The Encounter during which this [x] was created or to which the creation of this record is tightly associated.", 0, 1, encounter)); - children.add(new Property("supportingInformation", "Reference(Any)", "Include additional information (for example, patient height and weight) that supports the ordering of the medication.", 0, java.lang.Integer.MAX_VALUE, supportingInformation)); - children.add(new Property("authoredOn", "dateTime", "The date (and perhaps time) when the prescription was initially written or authored on.", 0, 1, authoredOn)); - children.add(new Property("requester", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson|Device)", "The individual, organization, or device that initiated the request and has responsibility for its activation.", 0, 1, requester)); - children.add(new Property("performer", "Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson|CareTeam)", "The specified desired performer of the medication treatment (e.g. the performer of the medication administration).", 0, 1, performer)); - children.add(new Property("performerType", "CodeableConcept", "Indicates the type of performer of the administration of the medication.", 0, 1, performerType)); - children.add(new Property("recorder", "Reference(Practitioner|PractitionerRole)", "The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.", 0, 1, recorder)); - children.add(new Property("reasonCode", "CodeableConcept", "The reason or the indication for ordering or not ordering the medication.", 0, java.lang.Integer.MAX_VALUE, reasonCode)); - children.add(new Property("reasonReference", "Reference(Condition|Observation)", "Condition or observation that supports why the medication was ordered.", 0, java.lang.Integer.MAX_VALUE, reasonReference)); - children.add(new Property("instantiatesCanonical", "canonical", "The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical)); - children.add(new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri)); - children.add(new Property("basedOn", "Reference(CarePlan|MedicationRequest|ServiceRequest|ImmunizationRecommendation)", "A plan or request that is fulfilled in whole or in part by this medication request.", 0, java.lang.Integer.MAX_VALUE, basedOn)); - children.add(new Property("groupIdentifier", "Identifier", "A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.", 0, 1, groupIdentifier)); - children.add(new Property("courseOfTherapyType", "CodeableConcept", "The description of the overall patte3rn of the administration of the medication to the patient.", 0, 1, courseOfTherapyType)); - children.add(new Property("insurance", "Reference(Coverage|ClaimResponse)", "Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.", 0, java.lang.Integer.MAX_VALUE, insurance)); - children.add(new Property("note", "Annotation", "Extra information about the prescription that could not be conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note)); - children.add(new Property("dosageInstruction", "Dosage", "Indicates how the medication is to be used by the patient.", 0, java.lang.Integer.MAX_VALUE, dosageInstruction)); - children.add(new Property("dispenseRequest", "", "Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.", 0, 1, dispenseRequest)); - children.add(new Property("substitution", "", "Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.", 0, 1, substitution)); - children.add(new Property("priorPrescription", "Reference(MedicationRequest)", "A link to a resource representing an earlier order related order or prescription.", 0, 1, priorPrescription)); - children.add(new Property("detectedIssue", "Reference(DetectedIssue)", "Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc.", 0, java.lang.Integer.MAX_VALUE, detectedIssue)); - children.add(new Property("eventHistory", "Reference(Provenance)", "Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.", 0, java.lang.Integer.MAX_VALUE, eventHistory)); - } - - @Override - public Property getNamedProperty(int _hash, String _name, boolean _checkValid) throws FHIRException { - switch (_hash) { - case -1618432855: /*identifier*/ return new Property("identifier", "Identifier", "Identifiers associated with this medication request that are defined by business processes and/or used to refer to it when a direct URL reference to the resource itself is not appropriate. They are business identifiers assigned to this resource by the performer or other systems and remain constant as the resource is updated and propagates from server to server.", 0, java.lang.Integer.MAX_VALUE, identifier); - case -892481550: /*status*/ return new Property("status", "code", "A code specifying the current state of the order. Generally, this will be active or completed state.", 0, 1, status); - case 2051346646: /*statusReason*/ return new Property("statusReason", "CodeableConcept", "Captures the reason for the current state of the MedicationRequest.", 0, 1, statusReason); - case -1183762788: /*intent*/ return new Property("intent", "code", "Whether the request is a proposal, plan, or an original order.", 0, 1, intent); - case 50511102: /*category*/ return new Property("category", "CodeableConcept", "Indicates the type of medication request (for example, where the medication is expected to be consumed or administered (i.e. inpatient or outpatient)).", 0, java.lang.Integer.MAX_VALUE, category); - case -1165461084: /*priority*/ return new Property("priority", "code", "Indicates how quickly the Medication Request should be addressed with respect to other requests.", 0, 1, priority); - case -1788508167: /*doNotPerform*/ return new Property("doNotPerform", "boolean", "If true indicates that the provider is asking for the medication request not to occur.", 0, 1, doNotPerform); - case -241505587: /*reported[x]*/ return new Property("reported[x]", "boolean|Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.", 0, 1, reported); - case -427039533: /*reported*/ return new Property("reported[x]", "boolean|Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.", 0, 1, reported); - case 1219992533: /*reportedBoolean*/ return new Property("reported[x]", "boolean|Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.", 0, 1, reported); - case 1198143416: /*reportedReference*/ return new Property("reported[x]", "boolean|Reference(Patient|Practitioner|PractitionerRole|RelatedPerson|Organization)", "Indicates if this record was captured as a secondary 'reported' record rather than as an original primary source-of-truth record. It may also indicate the source of the report.", 0, 1, reported); - case 1458402129: /*medication[x]*/ return new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication); - case 1998965455: /*medication*/ return new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication); - case -209845038: /*medicationCodeableConcept*/ return new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication); - case 2104315196: /*medicationReference*/ return new Property("medication[x]", "CodeableConcept|Reference(Medication)", "Identifies the medication being requested. This is a link to a resource that represents the medication which may be the details of the medication or simply an attribute carrying a code that identifies the medication from a known list of medications.", 0, 1, medication); - case -1867885268: /*subject*/ return new Property("subject", "Reference(Patient|Group)", "A link to a resource representing the person or set of individuals to whom the medication will be given.", 0, 1, subject); - case 1524132147: /*encounter*/ return new Property("encounter", "Reference(Encounter)", "The Encounter during which this [x] was created or to which the creation of this record is tightly associated.", 0, 1, encounter); - case -1248768647: /*supportingInformation*/ return new Property("supportingInformation", "Reference(Any)", "Include additional information (for example, patient height and weight) that supports the ordering of the medication.", 0, java.lang.Integer.MAX_VALUE, supportingInformation); - case -1500852503: /*authoredOn*/ return new Property("authoredOn", "dateTime", "The date (and perhaps time) when the prescription was initially written or authored on.", 0, 1, authoredOn); - case 693933948: /*requester*/ return new Property("requester", "Reference(Practitioner|PractitionerRole|Organization|Patient|RelatedPerson|Device)", "The individual, organization, or device that initiated the request and has responsibility for its activation.", 0, 1, requester); - case 481140686: /*performer*/ return new Property("performer", "Reference(Practitioner|PractitionerRole|Organization|Patient|Device|RelatedPerson|CareTeam)", "The specified desired performer of the medication treatment (e.g. the performer of the medication administration).", 0, 1, performer); - case -901444568: /*performerType*/ return new Property("performerType", "CodeableConcept", "Indicates the type of performer of the administration of the medication.", 0, 1, performerType); - case -799233858: /*recorder*/ return new Property("recorder", "Reference(Practitioner|PractitionerRole)", "The person who entered the order on behalf of another individual for example in the case of a verbal or a telephone order.", 0, 1, recorder); - case 722137681: /*reasonCode*/ return new Property("reasonCode", "CodeableConcept", "The reason or the indication for ordering or not ordering the medication.", 0, java.lang.Integer.MAX_VALUE, reasonCode); - case -1146218137: /*reasonReference*/ return new Property("reasonReference", "Reference(Condition|Observation)", "Condition or observation that supports why the medication was ordered.", 0, java.lang.Integer.MAX_VALUE, reasonReference); - case 8911915: /*instantiatesCanonical*/ return new Property("instantiatesCanonical", "canonical", "The URL pointing to a protocol, guideline, orderset, or other definition that is adhered to in whole or in part by this MedicationRequest.", 0, java.lang.Integer.MAX_VALUE, instantiatesCanonical); - case -1926393373: /*instantiatesUri*/ return new Property("instantiatesUri", "uri", "The URL pointing to an externally maintained protocol, guideline, orderset or other definition that is adhered to in whole or in part by this MedicationRequest.", 0, java.lang.Integer.MAX_VALUE, instantiatesUri); - case -332612366: /*basedOn*/ return new Property("basedOn", "Reference(CarePlan|MedicationRequest|ServiceRequest|ImmunizationRecommendation)", "A plan or request that is fulfilled in whole or in part by this medication request.", 0, java.lang.Integer.MAX_VALUE, basedOn); - case -445338488: /*groupIdentifier*/ return new Property("groupIdentifier", "Identifier", "A shared identifier common to all requests that were authorized more or less simultaneously by a single author, representing the identifier of the requisition or prescription.", 0, 1, groupIdentifier); - case -447282031: /*courseOfTherapyType*/ return new Property("courseOfTherapyType", "CodeableConcept", "The description of the overall patte3rn of the administration of the medication to the patient.", 0, 1, courseOfTherapyType); - case 73049818: /*insurance*/ return new Property("insurance", "Reference(Coverage|ClaimResponse)", "Insurance plans, coverage extensions, pre-authorizations and/or pre-determinations that may be required for delivering the requested service.", 0, java.lang.Integer.MAX_VALUE, insurance); - case 3387378: /*note*/ return new Property("note", "Annotation", "Extra information about the prescription that could not be conveyed by the other attributes.", 0, java.lang.Integer.MAX_VALUE, note); - case -1201373865: /*dosageInstruction*/ return new Property("dosageInstruction", "Dosage", "Indicates how the medication is to be used by the patient.", 0, java.lang.Integer.MAX_VALUE, dosageInstruction); - case 824620658: /*dispenseRequest*/ return new Property("dispenseRequest", "", "Indicates the specific details for the dispense or medication supply part of a medication request (also known as a Medication Prescription or Medication Order). Note that this information is not always sent with the order. There may be in some settings (e.g. hospitals) institutional or system support for completing the dispense details in the pharmacy department.", 0, 1, dispenseRequest); - case 826147581: /*substitution*/ return new Property("substitution", "", "Indicates whether or not substitution can or should be part of the dispense. In some cases, substitution must happen, in other cases substitution must not happen. This block explains the prescriber's intent. If nothing is specified substitution may be done.", 0, 1, substitution); - case -486355964: /*priorPrescription*/ return new Property("priorPrescription", "Reference(MedicationRequest)", "A link to a resource representing an earlier order related order or prescription.", 0, 1, priorPrescription); - case 51602295: /*detectedIssue*/ return new Property("detectedIssue", "Reference(DetectedIssue)", "Indicates an actual or potential clinical issue with or between one or more active or proposed clinical actions for a patient; e.g. Drug-drug interaction, duplicate therapy, dosage alert etc.", 0, java.lang.Integer.MAX_VALUE, detectedIssue); - case 1835190426: /*eventHistory*/ return new Property("eventHistory", "Reference(Provenance)", "Links to Provenance records for past versions of this resource or fulfilling request or event resources that identify key state transitions or updates that are likely to be relevant to a user looking at the current version of the resource.", 0, java.lang.Integer.MAX_VALUE, eventHistory); - default: return super.getNamedProperty(_hash, _name, _checkValid); - } - - } - - @Override - public Base[] getProperty(int hash, String name, boolean checkValid) throws FHIRException { - switch (hash) { - case -1618432855: /*identifier*/ return this.identifier == null ? new Base[0] : this.identifier.toArray(new Base[this.identifier.size()]); // Identifier - case -892481550: /*status*/ return this.status == null ? new Base[0] : new Base[] {this.status}; // Enumeration - case 2051346646: /*statusReason*/ return this.statusReason == null ? new Base[0] : new Base[] {this.statusReason}; // CodeableConcept - case -1183762788: /*intent*/ return this.intent == null ? new Base[0] : new Base[] {this.intent}; // Enumeration - case 50511102: /*category*/ return this.category == null ? new Base[0] : this.category.toArray(new Base[this.category.size()]); // CodeableConcept - case -1165461084: /*priority*/ return this.priority == null ? new Base[0] : new Base[] {this.priority}; // Enumeration - case -1788508167: /*doNotPerform*/ return this.doNotPerform == null ? new Base[0] : new Base[] {this.doNotPerform}; // BooleanType - case -427039533: /*reported*/ return this.reported == null ? new Base[0] : new Base[] {this.reported}; // Type - case 1998965455: /*medication*/ return this.medication == null ? new Base[0] : new Base[] {this.medication}; // Type - case -1867885268: /*subject*/ return this.subject == null ? new Base[0] : new Base[] {this.subject}; // Reference - case 1524132147: /*encounter*/ return this.encounter == null ? new Base[0] : new Base[] {this.encounter}; // Reference - case -1248768647: /*supportingInformation*/ return this.supportingInformation == null ? new Base[0] : this.supportingInformation.toArray(new Base[this.supportingInformation.size()]); // Reference - case -1500852503: /*authoredOn*/ return this.authoredOn == null ? new Base[0] : new Base[] {this.authoredOn}; // DateTimeType - case 693933948: /*requester*/ return this.requester == null ? new Base[0] : new Base[] {this.requester}; // Reference - case 481140686: /*performer*/ return this.performer == null ? new Base[0] : new Base[] {this.performer}; // Reference - case -901444568: /*performerType*/ return this.performerType == null ? new Base[0] : new Base[] {this.performerType}; // CodeableConcept - case -799233858: /*recorder*/ return this.recorder == null ? new Base[0] : new Base[] {this.recorder}; // Reference - case 722137681: /*reasonCode*/ return this.reasonCode == null ? new Base[0] : this.reasonCode.toArray(new Base[this.reasonCode.size()]); // CodeableConcept - case -1146218137: /*reasonReference*/ return this.reasonReference == null ? new Base[0] : this.reasonReference.toArray(new Base[this.reasonReference.size()]); // Reference - case 8911915: /*instantiatesCanonical*/ return this.instantiatesCanonical == null ? new Base[0] : this.instantiatesCanonical.toArray(new Base[this.instantiatesCanonical.size()]); // CanonicalType - case -1926393373: /*instantiatesUri*/ return this.instantiatesUri == null ? new Base[0] : this.instantiatesUri.toArray(new Base[this.instantiatesUri.size()]); // UriType - case -332612366: /*basedOn*/ return this.basedOn == null ? new Base[0] : this.basedOn.toArray(new Base[this.basedOn.size()]); // Reference - case -445338488: /*groupIdentifier*/ return this.groupIdentifier == null ? new Base[0] : new Base[] {this.groupIdentifier}; // Identifier - case -447282031: /*courseOfTherapyType*/ return this.courseOfTherapyType == null ? new Base[0] : new Base[] {this.courseOfTherapyType}; // CodeableConcept - case 73049818: /*insurance*/ return this.insurance == null ? new Base[0] : this.insurance.toArray(new Base[this.insurance.size()]); // Reference - case 3387378: /*note*/ return this.note == null ? new Base[0] : this.note.toArray(new Base[this.note.size()]); // Annotation - case -1201373865: /*dosageInstruction*/ return this.dosageInstruction == null ? new Base[0] : this.dosageInstruction.toArray(new Base[this.dosageInstruction.size()]); // Dosage - case 824620658: /*dispenseRequest*/ return this.dispenseRequest == null ? new Base[0] : new Base[] {this.dispenseRequest}; // MedicationRequestDispenseRequestComponent - case 826147581: /*substitution*/ return this.substitution == null ? new Base[0] : new Base[] {this.substitution}; // MedicationRequestSubstitutionComponent - case -486355964: /*priorPrescription*/ return this.priorPrescription == null ? new Base[0] : new Base[] {this.priorPrescription}; // Reference - case 51602295: /*detectedIssue*/ return this.detectedIssue == null ? new Base[0] : this.detectedIssue.toArray(new Base[this.detectedIssue.size()]); // Reference - case 1835190426: /*eventHistory*/ return this.eventHistory == null ? new Base[0] : this.eventHistory.toArray(new Base[this.eventHistory.size()]); // Reference - default: return super.getProperty(hash, name, checkValid); - } - - } - - @Override - public Base setProperty(int hash, String name, Base value) throws FHIRException { - switch (hash) { - case -1618432855: // identifier - this.getIdentifier().add(castToIdentifier(value)); // Identifier - return value; - case -892481550: // status - value = new MedicationRequestStatusEnumFactory().fromType(castToCode(value)); - this.status = (Enumeration) value; // Enumeration - return value; - case 2051346646: // statusReason - this.statusReason = castToCodeableConcept(value); // CodeableConcept - return value; - case -1183762788: // intent - value = new MedicationRequestIntentEnumFactory().fromType(castToCode(value)); - this.intent = (Enumeration) value; // Enumeration - return value; - case 50511102: // category - this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept - return value; - case -1165461084: // priority - value = new MedicationRequestPriorityEnumFactory().fromType(castToCode(value)); - this.priority = (Enumeration) value; // Enumeration - return value; - case -1788508167: // doNotPerform - this.doNotPerform = castToBoolean(value); // BooleanType - return value; - case -427039533: // reported - this.reported = castToType(value); // Type - return value; - case 1998965455: // medication - this.medication = castToType(value); // Type - return value; - case -1867885268: // subject - this.subject = castToReference(value); // Reference - return value; - case 1524132147: // encounter - this.encounter = castToReference(value); // Reference - return value; - case -1248768647: // supportingInformation - this.getSupportingInformation().add(castToReference(value)); // Reference - return value; - case -1500852503: // authoredOn - this.authoredOn = castToDateTime(value); // DateTimeType - return value; - case 693933948: // requester - this.requester = castToReference(value); // Reference - return value; - case 481140686: // performer - this.performer = castToReference(value); // Reference - return value; - case -901444568: // performerType - this.performerType = castToCodeableConcept(value); // CodeableConcept - return value; - case -799233858: // recorder - this.recorder = castToReference(value); // Reference - return value; - case 722137681: // reasonCode - this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept - return value; - case -1146218137: // reasonReference - this.getReasonReference().add(castToReference(value)); // Reference - return value; - case 8911915: // instantiatesCanonical - this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType - return value; - case -1926393373: // instantiatesUri - this.getInstantiatesUri().add(castToUri(value)); // UriType - return value; - case -332612366: // basedOn - this.getBasedOn().add(castToReference(value)); // Reference - return value; - case -445338488: // groupIdentifier - this.groupIdentifier = castToIdentifier(value); // Identifier - return value; - case -447282031: // courseOfTherapyType - this.courseOfTherapyType = castToCodeableConcept(value); // CodeableConcept - return value; - case 73049818: // insurance - this.getInsurance().add(castToReference(value)); // Reference - return value; - case 3387378: // note - this.getNote().add(castToAnnotation(value)); // Annotation - return value; - case -1201373865: // dosageInstruction - this.getDosageInstruction().add(castToDosage(value)); // Dosage - return value; - case 824620658: // dispenseRequest - this.dispenseRequest = (MedicationRequestDispenseRequestComponent) value; // MedicationRequestDispenseRequestComponent - return value; - case 826147581: // substitution - this.substitution = (MedicationRequestSubstitutionComponent) value; // MedicationRequestSubstitutionComponent - return value; - case -486355964: // priorPrescription - this.priorPrescription = castToReference(value); // Reference - return value; - case 51602295: // detectedIssue - this.getDetectedIssue().add(castToReference(value)); // Reference - return value; - case 1835190426: // eventHistory - this.getEventHistory().add(castToReference(value)); // Reference - return value; - default: return super.setProperty(hash, name, value); - } - - } - - @Override - public Base setProperty(String name, Base value) throws FHIRException { - if (name.equals("identifier")) { - this.getIdentifier().add(castToIdentifier(value)); - } else if (name.equals("status")) { - value = new MedicationRequestStatusEnumFactory().fromType(castToCode(value)); - this.status = (Enumeration) value; // Enumeration - } else if (name.equals("statusReason")) { - this.statusReason = castToCodeableConcept(value); // CodeableConcept - } else if (name.equals("intent")) { - value = new MedicationRequestIntentEnumFactory().fromType(castToCode(value)); - this.intent = (Enumeration) value; // Enumeration - } else if (name.equals("category")) { - this.getCategory().add(castToCodeableConcept(value)); - } else if (name.equals("priority")) { - value = new MedicationRequestPriorityEnumFactory().fromType(castToCode(value)); - this.priority = (Enumeration) value; // Enumeration - } else if (name.equals("doNotPerform")) { - this.doNotPerform = castToBoolean(value); // BooleanType - } else if (name.equals("reported[x]")) { - this.reported = castToType(value); // Type - } else if (name.equals("medication[x]")) { - this.medication = castToType(value); // Type - } else if (name.equals("subject")) { - this.subject = castToReference(value); // Reference - } else if (name.equals("encounter")) { - this.encounter = castToReference(value); // Reference - } else if (name.equals("supportingInformation")) { - this.getSupportingInformation().add(castToReference(value)); - } else if (name.equals("authoredOn")) { - this.authoredOn = castToDateTime(value); // DateTimeType - } else if (name.equals("requester")) { - this.requester = castToReference(value); // Reference - } else if (name.equals("performer")) { - this.performer = castToReference(value); // Reference - } else if (name.equals("performerType")) { - this.performerType = castToCodeableConcept(value); // CodeableConcept - } else if (name.equals("recorder")) { - this.recorder = castToReference(value); // Reference - } else if (name.equals("reasonCode")) { - this.getReasonCode().add(castToCodeableConcept(value)); - } else if (name.equals("reasonReference")) { - this.getReasonReference().add(castToReference(value)); - } else if (name.equals("instantiatesCanonical")) { - this.getInstantiatesCanonical().add(castToCanonical(value)); - } else if (name.equals("instantiatesUri")) { - this.getInstantiatesUri().add(castToUri(value)); - } else if (name.equals("basedOn")) { - this.getBasedOn().add(castToReference(value)); - } else if (name.equals("groupIdentifier")) { - this.groupIdentifier = castToIdentifier(value); // Identifier - } else if (name.equals("courseOfTherapyType")) { - this.courseOfTherapyType = castToCodeableConcept(value); // CodeableConcept - } else if (name.equals("insurance")) { - this.getInsurance().add(castToReference(value)); - } else if (name.equals("note")) { - this.getNote().add(castToAnnotation(value)); - } else if (name.equals("dosageInstruction")) { - this.getDosageInstruction().add(castToDosage(value)); - } else if (name.equals("dispenseRequest")) { - this.dispenseRequest = (MedicationRequestDispenseRequestComponent) value; // MedicationRequestDispenseRequestComponent - } else if (name.equals("substitution")) { - this.substitution = (MedicationRequestSubstitutionComponent) value; // MedicationRequestSubstitutionComponent - } else if (name.equals("priorPrescription")) { - this.priorPrescription = castToReference(value); // Reference - } else if (name.equals("detectedIssue")) { - this.getDetectedIssue().add(castToReference(value)); - } else if (name.equals("eventHistory")) { - this.getEventHistory().add(castToReference(value)); - } else - return super.setProperty(name, value); + @Override + public Base setProperty(int hash, String name, Base value) throws FHIRException { + switch (hash) { + case -1618432855: // identifier + this.getIdentifier().add(castToIdentifier(value)); // Identifier return value; - } + case -892481550: // status + value = new MedicationRequestStatusEnumFactory().fromType(castToCode(value)); + this.status = (Enumeration) value; // Enumeration + return value; + case 2051346646: // statusReason + this.statusReason = castToCodeableConcept(value); // CodeableConcept + return value; + case -1183762788: // intent + value = new MedicationRequestIntentEnumFactory().fromType(castToCode(value)); + this.intent = (Enumeration) value; // Enumeration + return value; + case 50511102: // category + this.getCategory().add(castToCodeableConcept(value)); // CodeableConcept + return value; + case -1165461084: // priority + value = new MedicationRequestPriorityEnumFactory().fromType(castToCode(value)); + this.priority = (Enumeration) value; // Enumeration + return value; + case -1788508167: // doNotPerform + this.doNotPerform = castToBoolean(value); // BooleanType + return value; + case -427039533: // reported + this.reported = castToType(value); // Type + return value; + case 1998965455: // medication + this.medication = castToType(value); // Type + return value; + case -1867885268: // subject + this.subject = castToReference(value); // Reference + return value; + case 1524132147: // encounter + this.encounter = castToReference(value); // Reference + return value; + case -1248768647: // supportingInformation + this.getSupportingInformation().add(castToReference(value)); // Reference + return value; + case -1500852503: // authoredOn + this.authoredOn = castToDateTime(value); // DateTimeType + return value; + case 693933948: // requester + this.requester = castToReference(value); // Reference + return value; + case 481140686: // performer + this.performer = castToReference(value); // Reference + return value; + case -901444568: // performerType + this.performerType = castToCodeableConcept(value); // CodeableConcept + return value; + case -799233858: // recorder + this.recorder = castToReference(value); // Reference + return value; + case 722137681: // reasonCode + this.getReasonCode().add(castToCodeableConcept(value)); // CodeableConcept + return value; + case -1146218137: // reasonReference + this.getReasonReference().add(castToReference(value)); // Reference + return value; + case 8911915: // instantiatesCanonical + this.getInstantiatesCanonical().add(castToCanonical(value)); // CanonicalType + return value; + case -1926393373: // instantiatesUri + this.getInstantiatesUri().add(castToUri(value)); // UriType + return value; + case -332612366: // basedOn + this.getBasedOn().add(castToReference(value)); // Reference + return value; + case -445338488: // groupIdentifier + this.groupIdentifier = castToIdentifier(value); // Identifier + return value; + case -447282031: // courseOfTherapyType + this.courseOfTherapyType = castToCodeableConcept(value); // CodeableConcept + return value; + case 73049818: // insurance + this.getInsurance().add(castToReference(value)); // Reference + return value; + case 3387378: // note + this.getNote().add(castToAnnotation(value)); // Annotation + return value; + case -1201373865: // dosageInstruction + this.getDosageInstruction().add(castToDosage(value)); // Dosage + return value; + case 824620658: // dispenseRequest + this.dispenseRequest = (MedicationRequestDispenseRequestComponent) value; // MedicationRequestDispenseRequestComponent + return value; + case 826147581: // substitution + this.substitution = (MedicationRequestSubstitutionComponent) value; // MedicationRequestSubstitutionComponent + return value; + case -486355964: // priorPrescription + this.priorPrescription = castToReference(value); // Reference + return value; + case 51602295: // detectedIssue + this.getDetectedIssue().add(castToReference(value)); // Reference + return value; + case 1835190426: // eventHistory + this.getEventHistory().add(castToReference(value)); // Reference + return value; + default: + return super.setProperty(hash, name, value); + } - @Override - public Base makeProperty(int hash, String name) throws FHIRException { - switch (hash) { - case -1618432855: return addIdentifier(); - case -892481550: return getStatusElement(); - case 2051346646: return getStatusReason(); - case -1183762788: return getIntentElement(); - case 50511102: return addCategory(); - case -1165461084: return getPriorityElement(); - case -1788508167: return getDoNotPerformElement(); - case -241505587: return getReported(); - case -427039533: return getReported(); - case 1458402129: return getMedication(); - case 1998965455: return getMedication(); - case -1867885268: return getSubject(); - case 1524132147: return getEncounter(); - case -1248768647: return addSupportingInformation(); - case -1500852503: return getAuthoredOnElement(); - case 693933948: return getRequester(); - case 481140686: return getPerformer(); - case -901444568: return getPerformerType(); - case -799233858: return getRecorder(); - case 722137681: return addReasonCode(); - case -1146218137: return addReasonReference(); - case 8911915: return addInstantiatesCanonicalElement(); - case -1926393373: return addInstantiatesUriElement(); - case -332612366: return addBasedOn(); - case -445338488: return getGroupIdentifier(); - case -447282031: return getCourseOfTherapyType(); - case 73049818: return addInsurance(); - case 3387378: return addNote(); - case -1201373865: return addDosageInstruction(); - case 824620658: return getDispenseRequest(); - case 826147581: return getSubstitution(); - case -486355964: return getPriorPrescription(); - case 51602295: return addDetectedIssue(); - case 1835190426: return addEventHistory(); - default: return super.makeProperty(hash, name); - } + } - } + @Override + public Base setProperty(String name, Base value) throws FHIRException { + if (name.equals("identifier")) { + this.getIdentifier().add(castToIdentifier(value)); + } else if (name.equals("status")) { + value = new MedicationRequestStatusEnumFactory().fromType(castToCode(value)); + this.status = (Enumeration) value; // Enumeration + } else if (name.equals("statusReason")) { + this.statusReason = castToCodeableConcept(value); // CodeableConcept + } else if (name.equals("intent")) { + value = new MedicationRequestIntentEnumFactory().fromType(castToCode(value)); + this.intent = (Enumeration) value; // Enumeration + } else if (name.equals("category")) { + this.getCategory().add(castToCodeableConcept(value)); + } else if (name.equals("priority")) { + value = new MedicationRequestPriorityEnumFactory().fromType(castToCode(value)); + this.priority = (Enumeration) value; // Enumeration + } else if (name.equals("doNotPerform")) { + this.doNotPerform = castToBoolean(value); // BooleanType + } else if (name.equals("reported[x]")) { + this.reported = castToType(value); // Type + } else if (name.equals("medication[x]")) { + this.medication = castToType(value); // Type + } else if (name.equals("subject")) { + this.subject = castToReference(value); // Reference + } else if (name.equals("encounter")) { + this.encounter = castToReference(value); // Reference + } else if (name.equals("supportingInformation")) { + this.getSupportingInformation().add(castToReference(value)); + } else if (name.equals("authoredOn")) { + this.authoredOn = castToDateTime(value); // DateTimeType + } else if (name.equals("requester")) { + this.requester = castToReference(value); // Reference + } else if (name.equals("performer")) { + this.performer = castToReference(value); // Reference + } else if (name.equals("performerType")) { + this.performerType = castToCodeableConcept(value); // CodeableConcept + } else if (name.equals("recorder")) { + this.recorder = castToReference(value); // Reference + } else if (name.equals("reasonCode")) { + this.getReasonCode().add(castToCodeableConcept(value)); + } else if (name.equals("reasonReference")) { + this.getReasonReference().add(castToReference(value)); + } else if (name.equals("instantiatesCanonical")) { + this.getInstantiatesCanonical().add(castToCanonical(value)); + } else if (name.equals("instantiatesUri")) { + this.getInstantiatesUri().add(castToUri(value)); + } else if (name.equals("basedOn")) { + this.getBasedOn().add(castToReference(value)); + } else if (name.equals("groupIdentifier")) { + this.groupIdentifier = castToIdentifier(value); // Identifier + } else if (name.equals("courseOfTherapyType")) { + this.courseOfTherapyType = castToCodeableConcept(value); // CodeableConcept + } else if (name.equals("insurance")) { + this.getInsurance().add(castToReference(value)); + } else if (name.equals("note")) { + this.getNote().add(castToAnnotation(value)); + } else if (name.equals("dosageInstruction")) { + this.getDosageInstruction().add(castToDosage(value)); + } else if (name.equals("dispenseRequest")) { + this.dispenseRequest = (MedicationRequestDispenseRequestComponent) value; // MedicationRequestDispenseRequestComponent + } else if (name.equals("substitution")) { + this.substitution = (MedicationRequestSubstitutionComponent) value; // MedicationRequestSubstitutionComponent + } else if (name.equals("priorPrescription")) { + this.priorPrescription = castToReference(value); // Reference + } else if (name.equals("detectedIssue")) { + this.getDetectedIssue().add(castToReference(value)); + } else if (name.equals("eventHistory")) { + this.getEventHistory().add(castToReference(value)); + } else + return super.setProperty(name, value); + return value; + } - @Override - public String[] getTypesForProperty(int hash, String name) throws FHIRException { - switch (hash) { - case -1618432855: /*identifier*/ return new String[] {"Identifier"}; - case -892481550: /*status*/ return new String[] {"code"}; - case 2051346646: /*statusReason*/ return new String[] {"CodeableConcept"}; - case -1183762788: /*intent*/ return new String[] {"code"}; - case 50511102: /*category*/ return new String[] {"CodeableConcept"}; - case -1165461084: /*priority*/ return new String[] {"code"}; - case -1788508167: /*doNotPerform*/ return new String[] {"boolean"}; - case -427039533: /*reported*/ return new String[] {"boolean", "Reference"}; - case 1998965455: /*medication*/ return new String[] {"CodeableConcept", "Reference"}; - case -1867885268: /*subject*/ return new String[] {"Reference"}; - case 1524132147: /*encounter*/ return new String[] {"Reference"}; - case -1248768647: /*supportingInformation*/ return new String[] {"Reference"}; - case -1500852503: /*authoredOn*/ return new String[] {"dateTime"}; - case 693933948: /*requester*/ return new String[] {"Reference"}; - case 481140686: /*performer*/ return new String[] {"Reference"}; - case -901444568: /*performerType*/ return new String[] {"CodeableConcept"}; - case -799233858: /*recorder*/ return new String[] {"Reference"}; - case 722137681: /*reasonCode*/ return new String[] {"CodeableConcept"}; - case -1146218137: /*reasonReference*/ return new String[] {"Reference"}; - case 8911915: /*instantiatesCanonical*/ return new String[] {"canonical"}; - case -1926393373: /*instantiatesUri*/ return new String[] {"uri"}; - case -332612366: /*basedOn*/ return new String[] {"Reference"}; - case -445338488: /*groupIdentifier*/ return new String[] {"Identifier"}; - case -447282031: /*courseOfTherapyType*/ return new String[] {"CodeableConcept"}; - case 73049818: /*insurance*/ return new String[] {"Reference"}; - case 3387378: /*note*/ return new String[] {"Annotation"}; - case -1201373865: /*dosageInstruction*/ return new String[] {"Dosage"}; - case 824620658: /*dispenseRequest*/ return new String[] {}; - case 826147581: /*substitution*/ return new String[] {}; - case -486355964: /*priorPrescription*/ return new String[] {"Reference"}; - case 51602295: /*detectedIssue*/ return new String[] {"Reference"}; - case 1835190426: /*eventHistory*/ return new String[] {"Reference"}; - default: return super.getTypesForProperty(hash, name); - } + @Override + public Base makeProperty(int hash, String name) throws FHIRException { + switch (hash) { + case -1618432855: + return addIdentifier(); + case -892481550: + return getStatusElement(); + case 2051346646: + return getStatusReason(); + case -1183762788: + return getIntentElement(); + case 50511102: + return addCategory(); + case -1165461084: + return getPriorityElement(); + case -1788508167: + return getDoNotPerformElement(); + case -241505587: + return getReported(); + case -427039533: + return getReported(); + case 1458402129: + return getMedication(); + case 1998965455: + return getMedication(); + case -1867885268: + return getSubject(); + case 1524132147: + return getEncounter(); + case -1248768647: + return addSupportingInformation(); + case -1500852503: + return getAuthoredOnElement(); + case 693933948: + return getRequester(); + case 481140686: + return getPerformer(); + case -901444568: + return getPerformerType(); + case -799233858: + return getRecorder(); + case 722137681: + return addReasonCode(); + case -1146218137: + return addReasonReference(); + case 8911915: + return addInstantiatesCanonicalElement(); + case -1926393373: + return addInstantiatesUriElement(); + case -332612366: + return addBasedOn(); + case -445338488: + return getGroupIdentifier(); + case -447282031: + return getCourseOfTherapyType(); + case 73049818: + return addInsurance(); + case 3387378: + return addNote(); + case -1201373865: + return addDosageInstruction(); + case 824620658: + return getDispenseRequest(); + case 826147581: + return getSubstitution(); + case -486355964: + return getPriorPrescription(); + case 51602295: + return addDetectedIssue(); + case 1835190426: + return addEventHistory(); + default: + return super.makeProperty(hash, name); + } - } + } - @Override - public Base addChild(String name) throws FHIRException { - if (name.equals("identifier")) { - return addIdentifier(); - } - else if (name.equals("status")) { - throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.status"); - } - else if (name.equals("statusReason")) { - this.statusReason = new CodeableConcept(); - return this.statusReason; - } - else if (name.equals("intent")) { - throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.intent"); - } - else if (name.equals("category")) { - return addCategory(); - } - else if (name.equals("priority")) { - throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.priority"); - } - else if (name.equals("doNotPerform")) { - throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.doNotPerform"); - } - else if (name.equals("reportedBoolean")) { - this.reported = new BooleanType(); - return this.reported; - } - else if (name.equals("reportedReference")) { - this.reported = new Reference(); - return this.reported; - } - else if (name.equals("medicationCodeableConcept")) { - this.medication = new CodeableConcept(); - return this.medication; - } - else if (name.equals("medicationReference")) { - this.medication = new Reference(); - return this.medication; - } - else if (name.equals("subject")) { - this.subject = new Reference(); - return this.subject; - } - else if (name.equals("encounter")) { - this.encounter = new Reference(); - return this.encounter; - } - else if (name.equals("supportingInformation")) { - return addSupportingInformation(); - } - else if (name.equals("authoredOn")) { - throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.authoredOn"); - } - else if (name.equals("requester")) { - this.requester = new Reference(); - return this.requester; - } - else if (name.equals("performer")) { - this.performer = new Reference(); - return this.performer; - } - else if (name.equals("performerType")) { - this.performerType = new CodeableConcept(); - return this.performerType; - } - else if (name.equals("recorder")) { - this.recorder = new Reference(); - return this.recorder; - } - else if (name.equals("reasonCode")) { - return addReasonCode(); - } - else if (name.equals("reasonReference")) { - return addReasonReference(); - } - else if (name.equals("instantiatesCanonical")) { - throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.instantiatesCanonical"); - } - else if (name.equals("instantiatesUri")) { - throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.instantiatesUri"); - } - else if (name.equals("basedOn")) { - return addBasedOn(); - } - else if (name.equals("groupIdentifier")) { - this.groupIdentifier = new Identifier(); - return this.groupIdentifier; - } - else if (name.equals("courseOfTherapyType")) { - this.courseOfTherapyType = new CodeableConcept(); - return this.courseOfTherapyType; - } - else if (name.equals("insurance")) { - return addInsurance(); - } - else if (name.equals("note")) { - return addNote(); - } - else if (name.equals("dosageInstruction")) { - return addDosageInstruction(); - } - else if (name.equals("dispenseRequest")) { - this.dispenseRequest = new MedicationRequestDispenseRequestComponent(); - return this.dispenseRequest; - } - else if (name.equals("substitution")) { - this.substitution = new MedicationRequestSubstitutionComponent(); - return this.substitution; - } - else if (name.equals("priorPrescription")) { - this.priorPrescription = new Reference(); - return this.priorPrescription; - } - else if (name.equals("detectedIssue")) { - return addDetectedIssue(); - } - else if (name.equals("eventHistory")) { - return addEventHistory(); - } - else - return super.addChild(name); - } + @Override + public String[] getTypesForProperty(int hash, String name) throws FHIRException { + switch (hash) { + case -1618432855: /*identifier*/ + return new String[]{"Identifier"}; + case -892481550: /*status*/ + return new String[]{"code"}; + case 2051346646: /*statusReason*/ + return new String[]{"CodeableConcept"}; + case -1183762788: /*intent*/ + return new String[]{"code"}; + case 50511102: /*category*/ + return new String[]{"CodeableConcept"}; + case -1165461084: /*priority*/ + return new String[]{"code"}; + case -1788508167: /*doNotPerform*/ + return new String[]{"boolean"}; + case -427039533: /*reported*/ + return new String[]{"boolean", "Reference"}; + case 1998965455: /*medication*/ + return new String[]{"CodeableConcept", "Reference"}; + case -1867885268: /*subject*/ + return new String[]{"Reference"}; + case 1524132147: /*encounter*/ + return new String[]{"Reference"}; + case -1248768647: /*supportingInformation*/ + return new String[]{"Reference"}; + case -1500852503: /*authoredOn*/ + return new String[]{"dateTime"}; + case 693933948: /*requester*/ + return new String[]{"Reference"}; + case 481140686: /*performer*/ + return new String[]{"Reference"}; + case -901444568: /*performerType*/ + return new String[]{"CodeableConcept"}; + case -799233858: /*recorder*/ + return new String[]{"Reference"}; + case 722137681: /*reasonCode*/ + return new String[]{"CodeableConcept"}; + case -1146218137: /*reasonReference*/ + return new String[]{"Reference"}; + case 8911915: /*instantiatesCanonical*/ + return new String[]{"canonical"}; + case -1926393373: /*instantiatesUri*/ + return new String[]{"uri"}; + case -332612366: /*basedOn*/ + return new String[]{"Reference"}; + case -445338488: /*groupIdentifier*/ + return new String[]{"Identifier"}; + case -447282031: /*courseOfTherapyType*/ + return new String[]{"CodeableConcept"}; + case 73049818: /*insurance*/ + return new String[]{"Reference"}; + case 3387378: /*note*/ + return new String[]{"Annotation"}; + case -1201373865: /*dosageInstruction*/ + return new String[]{"Dosage"}; + case 824620658: /*dispenseRequest*/ + return new String[]{}; + case 826147581: /*substitution*/ + return new String[]{}; + case -486355964: /*priorPrescription*/ + return new String[]{"Reference"}; + case 51602295: /*detectedIssue*/ + return new String[]{"Reference"}; + case 1835190426: /*eventHistory*/ + return new String[]{"Reference"}; + default: + return super.getTypesForProperty(hash, name); + } + + } + + @Override + public Base addChild(String name) throws FHIRException { + if (name.equals("identifier")) { + return addIdentifier(); + } else if (name.equals("status")) { + throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.status"); + } else if (name.equals("statusReason")) { + this.statusReason = new CodeableConcept(); + return this.statusReason; + } else if (name.equals("intent")) { + throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.intent"); + } else if (name.equals("category")) { + return addCategory(); + } else if (name.equals("priority")) { + throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.priority"); + } else if (name.equals("doNotPerform")) { + throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.doNotPerform"); + } else if (name.equals("reportedBoolean")) { + this.reported = new BooleanType(); + return this.reported; + } else if (name.equals("reportedReference")) { + this.reported = new Reference(); + return this.reported; + } else if (name.equals("medicationCodeableConcept")) { + this.medication = new CodeableConcept(); + return this.medication; + } else if (name.equals("medicationReference")) { + this.medication = new Reference(); + return this.medication; + } else if (name.equals("subject")) { + this.subject = new Reference(); + return this.subject; + } else if (name.equals("encounter")) { + this.encounter = new Reference(); + return this.encounter; + } else if (name.equals("supportingInformation")) { + return addSupportingInformation(); + } else if (name.equals("authoredOn")) { + throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.authoredOn"); + } else if (name.equals("requester")) { + this.requester = new Reference(); + return this.requester; + } else if (name.equals("performer")) { + this.performer = new Reference(); + return this.performer; + } else if (name.equals("performerType")) { + this.performerType = new CodeableConcept(); + return this.performerType; + } else if (name.equals("recorder")) { + this.recorder = new Reference(); + return this.recorder; + } else if (name.equals("reasonCode")) { + return addReasonCode(); + } else if (name.equals("reasonReference")) { + return addReasonReference(); + } else if (name.equals("instantiatesCanonical")) { + throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.instantiatesCanonical"); + } else if (name.equals("instantiatesUri")) { + throw new FHIRException("Cannot call addChild on a primitive type MedicationRequest.instantiatesUri"); + } else if (name.equals("basedOn")) { + return addBasedOn(); + } else if (name.equals("groupIdentifier")) { + this.groupIdentifier = new Identifier(); + return this.groupIdentifier; + } else if (name.equals("courseOfTherapyType")) { + this.courseOfTherapyType = new CodeableConcept(); + return this.courseOfTherapyType; + } else if (name.equals("insurance")) { + return addInsurance(); + } else if (name.equals("note")) { + return addNote(); + } else if (name.equals("dosageInstruction")) { + return addDosageInstruction(); + } else if (name.equals("dispenseRequest")) { + this.dispenseRequest = new MedicationRequestDispenseRequestComponent(); + return this.dispenseRequest; + } else if (name.equals("substitution")) { + this.substitution = new MedicationRequestSubstitutionComponent(); + return this.substitution; + } else if (name.equals("priorPrescription")) { + this.priorPrescription = new Reference(); + return this.priorPrescription; + } else if (name.equals("detectedIssue")) { + return addDetectedIssue(); + } else if (name.equals("eventHistory")) { + return addEventHistory(); + } else + return super.addChild(name); + } public String fhirType() { return "MedicationRequest"; } - public MedicationRequest copy() { - MedicationRequest dst = new MedicationRequest(); - copyValues(dst); - if (identifier != null) { - dst.identifier = new ArrayList(); - for (Identifier i : identifier) - dst.identifier.add(i.copy()); - }; - dst.status = status == null ? null : status.copy(); - dst.statusReason = statusReason == null ? null : statusReason.copy(); - dst.intent = intent == null ? null : intent.copy(); - if (category != null) { - dst.category = new ArrayList(); - for (CodeableConcept i : category) - dst.category.add(i.copy()); - }; - dst.priority = priority == null ? null : priority.copy(); - dst.doNotPerform = doNotPerform == null ? null : doNotPerform.copy(); - dst.reported = reported == null ? null : reported.copy(); - dst.medication = medication == null ? null : medication.copy(); - dst.subject = subject == null ? null : subject.copy(); - dst.encounter = encounter == null ? null : encounter.copy(); - if (supportingInformation != null) { - dst.supportingInformation = new ArrayList(); - for (Reference i : supportingInformation) - dst.supportingInformation.add(i.copy()); - }; - dst.authoredOn = authoredOn == null ? null : authoredOn.copy(); - dst.requester = requester == null ? null : requester.copy(); - dst.performer = performer == null ? null : performer.copy(); - dst.performerType = performerType == null ? null : performerType.copy(); - dst.recorder = recorder == null ? null : recorder.copy(); - if (reasonCode != null) { - dst.reasonCode = new ArrayList(); - for (CodeableConcept i : reasonCode) - dst.reasonCode.add(i.copy()); - }; - if (reasonReference != null) { - dst.reasonReference = new ArrayList(); - for (Reference i : reasonReference) - dst.reasonReference.add(i.copy()); - }; - if (instantiatesCanonical != null) { - dst.instantiatesCanonical = new ArrayList(); - for (CanonicalType i : instantiatesCanonical) - dst.instantiatesCanonical.add(i.copy()); - }; - if (instantiatesUri != null) { - dst.instantiatesUri = new ArrayList(); - for (UriType i : instantiatesUri) - dst.instantiatesUri.add(i.copy()); - }; - if (basedOn != null) { - dst.basedOn = new ArrayList(); - for (Reference i : basedOn) - dst.basedOn.add(i.copy()); - }; - dst.groupIdentifier = groupIdentifier == null ? null : groupIdentifier.copy(); - dst.courseOfTherapyType = courseOfTherapyType == null ? null : courseOfTherapyType.copy(); - if (insurance != null) { - dst.insurance = new ArrayList(); - for (Reference i : insurance) - dst.insurance.add(i.copy()); - }; - if (note != null) { - dst.note = new ArrayList(); - for (Annotation i : note) - dst.note.add(i.copy()); - }; - if (dosageInstruction != null) { - dst.dosageInstruction = new ArrayList(); - for (Dosage i : dosageInstruction) - dst.dosageInstruction.add(i.copy()); - }; - dst.dispenseRequest = dispenseRequest == null ? null : dispenseRequest.copy(); - dst.substitution = substitution == null ? null : substitution.copy(); - dst.priorPrescription = priorPrescription == null ? null : priorPrescription.copy(); - if (detectedIssue != null) { - dst.detectedIssue = new ArrayList(); - for (Reference i : detectedIssue) - dst.detectedIssue.add(i.copy()); - }; - if (eventHistory != null) { - dst.eventHistory = new ArrayList(); - for (Reference i : eventHistory) - dst.eventHistory.add(i.copy()); - }; - return dst; - } + public MedicationRequest copy() { + MedicationRequest dst = new MedicationRequest(); + copyValues(dst); + if (identifier != null) { + dst.identifier = new ArrayList(); + for (Identifier i : identifier) + dst.identifier.add(i.copy()); + } + ; + dst.status = status == null ? null : status.copy(); + dst.statusReason = statusReason == null ? null : statusReason.copy(); + dst.intent = intent == null ? null : intent.copy(); + if (category != null) { + dst.category = new ArrayList(); + for (CodeableConcept i : category) + dst.category.add(i.copy()); + } + ; + dst.priority = priority == null ? null : priority.copy(); + dst.doNotPerform = doNotPerform == null ? null : doNotPerform.copy(); + dst.reported = reported == null ? null : reported.copy(); + dst.medication = medication == null ? null : medication.copy(); + dst.subject = subject == null ? null : subject.copy(); + dst.encounter = encounter == null ? null : encounter.copy(); + if (supportingInformation != null) { + dst.supportingInformation = new ArrayList(); + for (Reference i : supportingInformation) + dst.supportingInformation.add(i.copy()); + } - protected MedicationRequest typedCopy() { - return copy(); - } + dst.authoredOn = authoredOn == null ? null : authoredOn.copy(); + dst.requester = requester == null ? null : requester.copy(); + dst.performer = performer == null ? null : performer.copy(); + dst.performerType = performerType == null ? null : performerType.copy(); + dst.recorder = recorder == null ? null : recorder.copy(); + if (reasonCode != null) { + dst.reasonCode = new ArrayList(); + for (CodeableConcept i : reasonCode) + dst.reasonCode.add(i.copy()); + } - @Override - public boolean equalsDeep(Base other_) { - if (!super.equalsDeep(other_)) - return false; - if (!(other_ instanceof MedicationRequest)) - return false; - MedicationRequest o = (MedicationRequest) other_; - return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(statusReason, o.statusReason, true) - && compareDeep(intent, o.intent, true) && compareDeep(category, o.category, true) && compareDeep(priority, o.priority, true) - && compareDeep(doNotPerform, o.doNotPerform, true) && compareDeep(reported, o.reported, true) && compareDeep(medication, o.medication, true) - && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true) && compareDeep(supportingInformation, o.supportingInformation, true) - && compareDeep(authoredOn, o.authoredOn, true) && compareDeep(requester, o.requester, true) && compareDeep(performer, o.performer, true) - && compareDeep(performerType, o.performerType, true) && compareDeep(recorder, o.recorder, true) - && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true) - && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true) && compareDeep(instantiatesUri, o.instantiatesUri, true) - && compareDeep(basedOn, o.basedOn, true) && compareDeep(groupIdentifier, o.groupIdentifier, true) - && compareDeep(courseOfTherapyType, o.courseOfTherapyType, true) && compareDeep(insurance, o.insurance, true) - && compareDeep(note, o.note, true) && compareDeep(dosageInstruction, o.dosageInstruction, true) - && compareDeep(dispenseRequest, o.dispenseRequest, true) && compareDeep(substitution, o.substitution, true) - && compareDeep(priorPrescription, o.priorPrescription, true) && compareDeep(detectedIssue, o.detectedIssue, true) - && compareDeep(eventHistory, o.eventHistory, true); - } + if (reasonReference != null) { + dst.reasonReference = new ArrayList(); + for (Reference i : reasonReference) + dst.reasonReference.add(i.copy()); + } - @Override - public boolean equalsShallow(Base other_) { - if (!super.equalsShallow(other_)) - return false; - if (!(other_ instanceof MedicationRequest)) - return false; - MedicationRequest o = (MedicationRequest) other_; - return compareValues(status, o.status, true) && compareValues(intent, o.intent, true) && compareValues(priority, o.priority, true) - && compareValues(doNotPerform, o.doNotPerform, true) && compareValues(authoredOn, o.authoredOn, true) - && compareValues(instantiatesCanonical, o.instantiatesCanonical, true) && compareValues(instantiatesUri, o.instantiatesUri, true) - ; - } + if (instantiatesCanonical != null) { + dst.instantiatesCanonical = new ArrayList(); + for (CanonicalType i : instantiatesCanonical) + dst.instantiatesCanonical.add(i.copy()); + } - public boolean isEmpty() { - return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, statusReason - , intent, category, priority, doNotPerform, reported, medication, subject, encounter - , supportingInformation, authoredOn, requester, performer, performerType, recorder - , reasonCode, reasonReference, instantiatesCanonical, instantiatesUri, basedOn, groupIdentifier - , courseOfTherapyType, insurance, note, dosageInstruction, dispenseRequest, substitution - , priorPrescription, detectedIssue, eventHistory); - } + if (instantiatesUri != null) { + dst.instantiatesUri = new ArrayList(); + for (UriType i : instantiatesUri) + dst.instantiatesUri.add(i.copy()); + } + + if (basedOn != null) { + dst.basedOn = new ArrayList(); + for (Reference i : basedOn) + dst.basedOn.add(i.copy()); + } + ; + dst.groupIdentifier = groupIdentifier == null ? null : groupIdentifier.copy(); + dst.courseOfTherapyType = courseOfTherapyType == null ? null : courseOfTherapyType.copy(); + if (insurance != null) { + dst.insurance = new ArrayList(); + for (Reference i : insurance) + dst.insurance.add(i.copy()); + } + + if (note != null) { + dst.note = new ArrayList(); + for (Annotation i : note) + dst.note.add(i.copy()); + } + + if (dosageInstruction != null) { + dst.dosageInstruction = new ArrayList(); + for (Dosage i : dosageInstruction) + dst.dosageInstruction.add(i.copy()); + } + + dst.dispenseRequest = dispenseRequest == null ? null : dispenseRequest.copy(); + dst.substitution = substitution == null ? null : substitution.copy(); + dst.priorPrescription = priorPrescription == null ? null : priorPrescription.copy(); + if (detectedIssue != null) { + dst.detectedIssue = new ArrayList(); + for (Reference i : detectedIssue) + dst.detectedIssue.add(i.copy()); + } + + if (eventHistory != null) { + dst.eventHistory = new ArrayList(); + for (Reference i : eventHistory) + dst.eventHistory.add(i.copy()); + } + + return dst; + } + + protected MedicationRequest typedCopy() { + return copy(); + } + + @Override + public boolean equalsDeep(Base other_) { + if (!super.equalsDeep(other_)) + return false; + if (!(other_ instanceof MedicationRequest)) + return false; + MedicationRequest o = (MedicationRequest) other_; + return compareDeep(identifier, o.identifier, true) && compareDeep(status, o.status, true) && compareDeep(statusReason, o.statusReason, true) + && compareDeep(intent, o.intent, true) && compareDeep(category, o.category, true) && compareDeep(priority, o.priority, true) + && compareDeep(doNotPerform, o.doNotPerform, true) && compareDeep(reported, o.reported, true) && compareDeep(medication, o.medication, true) + && compareDeep(subject, o.subject, true) && compareDeep(encounter, o.encounter, true) && compareDeep(supportingInformation, o.supportingInformation, true) + && compareDeep(authoredOn, o.authoredOn, true) && compareDeep(requester, o.requester, true) && compareDeep(performer, o.performer, true) + && compareDeep(performerType, o.performerType, true) && compareDeep(recorder, o.recorder, true) + && compareDeep(reasonCode, o.reasonCode, true) && compareDeep(reasonReference, o.reasonReference, true) + && compareDeep(instantiatesCanonical, o.instantiatesCanonical, true) && compareDeep(instantiatesUri, o.instantiatesUri, true) + && compareDeep(basedOn, o.basedOn, true) && compareDeep(groupIdentifier, o.groupIdentifier, true) + && compareDeep(courseOfTherapyType, o.courseOfTherapyType, true) && compareDeep(insurance, o.insurance, true) + && compareDeep(note, o.note, true) && compareDeep(dosageInstruction, o.dosageInstruction, true) + && compareDeep(dispenseRequest, o.dispenseRequest, true) && compareDeep(substitution, o.substitution, true) + && compareDeep(priorPrescription, o.priorPrescription, true) && compareDeep(detectedIssue, o.detectedIssue, true) + && compareDeep(eventHistory, o.eventHistory, true); + } + + @Override + public boolean equalsShallow(Base other_) { + if (!super.equalsShallow(other_)) + return false; + if (!(other_ instanceof MedicationRequest)) + return false; + MedicationRequest o = (MedicationRequest) other_; + return compareValues(status, o.status, true) && compareValues(intent, o.intent, true) && compareValues(priority, o.priority, true) + && compareValues(doNotPerform, o.doNotPerform, true) && compareValues(authoredOn, o.authoredOn, true) + && compareValues(instantiatesCanonical, o.instantiatesCanonical, true) && compareValues(instantiatesUri, o.instantiatesUri, true) + ; + } + + public boolean isEmpty() { + return super.isEmpty() && ca.uhn.fhir.util.ElementUtil.isEmpty(identifier, status, statusReason + , intent, category, priority, doNotPerform, reported, medication, subject, encounter + , supportingInformation, authoredOn, requester, performer, performerType, recorder + , reasonCode, reasonReference, instantiatesCanonical, instantiatesUri, basedOn, groupIdentifier + , courseOfTherapyType, insurance, note, dosageInstruction, dispenseRequest, substitution + , priorPrescription, detectedIssue, eventHistory); + } @Override public ResourceType getResourceType() { return ResourceType.MedicationRequest; - } + } - /** + /** * Search parameter: requester *

* Description: Returns prescriptions prescribed by this prescriber
@@ -3975,9 +4263,9 @@ public class MedicationRequest extends DomainResource { * Path: MedicationRequest.requester
*

*/ - @SearchParamDefinition(name="requester", path="MedicationRequest.requester", description="Returns prescriptions prescribed by this prescriber", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Practitioner") }, target={Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } ) + @SearchParamDefinition(name = "requester", path = "MedicationRequest.requester", description = "Returns prescriptions prescribed by this prescriber", type = "reference", providesMembershipIn = {@ca.uhn.fhir.model.api.annotation.Compartment(name = "Practitioner")}, target = {Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}) public static final String SP_REQUESTER = "requester"; - /** + /** * Fluent Client search parameter constant for requester *

* Description: Returns prescriptions prescribed by this prescriber
@@ -3987,13 +4275,13 @@ public class MedicationRequest extends DomainResource { */ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam REQUESTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_REQUESTER); -/** + /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "MedicationRequest:requester". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_REQUESTER = new ca.uhn.fhir.model.api.Include("MedicationRequest:requester").toLocked(); - /** + /** * Search parameter: date *

* Description: Returns medication request to be administered on a specific date
@@ -4001,9 +4289,9 @@ public class MedicationRequest extends DomainResource { * Path: MedicationRequest.dosageInstruction.timing.event
*

*/ - @SearchParamDefinition(name="date", path="MedicationRequest.dosageInstruction.timing.event", description="Returns medication request to be administered on a specific date", type="date" ) + @SearchParamDefinition(name = "date", path = "MedicationRequest.dosageInstruction.timing.event", description = "Returns medication request to be administered on a specific date", type = "date") public static final String SP_DATE = "date"; - /** + /** * Fluent Client search parameter constant for date *

* Description: Returns medication request to be administered on a specific date
@@ -4013,7 +4301,7 @@ public class MedicationRequest extends DomainResource { */ public static final ca.uhn.fhir.rest.gclient.DateClientParam DATE = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_DATE); - /** + /** * Search parameter: identifier *

* Description: Return prescriptions with this external identifier
@@ -4021,9 +4309,9 @@ public class MedicationRequest extends DomainResource { * Path: MedicationRequest.identifier
*

*/ - @SearchParamDefinition(name="identifier", path="MedicationRequest.identifier", description="Return prescriptions with this external identifier", type="token" ) + @SearchParamDefinition(name = "identifier", path = "MedicationRequest.identifier", description = "Return prescriptions with this external identifier", type = "token") public static final String SP_IDENTIFIER = "identifier"; - /** + /** * Fluent Client search parameter constant for identifier *

* Description: Return prescriptions with this external identifier
@@ -4033,7 +4321,7 @@ public class MedicationRequest extends DomainResource { */ public static final ca.uhn.fhir.rest.gclient.TokenClientParam IDENTIFIER = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_IDENTIFIER); - /** + /** * Search parameter: intended-dispenser *

* Description: Returns prescriptions intended to be dispensed by this Organization
@@ -4041,9 +4329,9 @@ public class MedicationRequest extends DomainResource { * Path: MedicationRequest.dispenseRequest.performer
*

*/ - @SearchParamDefinition(name="intended-dispenser", path="MedicationRequest.dispenseRequest.performer", description="Returns prescriptions intended to be dispensed by this Organization", type="reference", target={Organization.class } ) + @SearchParamDefinition(name = "intended-dispenser", path = "MedicationRequest.dispenseRequest.performer", description = "Returns prescriptions intended to be dispensed by this Organization", type = "reference", target = {Organization.class}) public static final String SP_INTENDED_DISPENSER = "intended-dispenser"; - /** + /** * Fluent Client search parameter constant for intended-dispenser *

* Description: Returns prescriptions intended to be dispensed by this Organization
@@ -4053,13 +4341,13 @@ public class MedicationRequest extends DomainResource { */ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INTENDED_DISPENSER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INTENDED_DISPENSER); -/** + /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "MedicationRequest:intended-dispenser". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_INTENDED_DISPENSER = new ca.uhn.fhir.model.api.Include("MedicationRequest:intended-dispenser").toLocked(); - /** + /** * Search parameter: authoredon *

* Description: Return prescriptions written on this date
@@ -4067,9 +4355,9 @@ public class MedicationRequest extends DomainResource { * Path: MedicationRequest.authoredOn
*

*/ - @SearchParamDefinition(name="authoredon", path="MedicationRequest.authoredOn", description="Return prescriptions written on this date", type="date" ) + @SearchParamDefinition(name = "authoredon", path = "MedicationRequest.authoredOn", description = "Return prescriptions written on this date", type = "date") public static final String SP_AUTHOREDON = "authoredon"; - /** + /** * Fluent Client search parameter constant for authoredon *

* Description: Return prescriptions written on this date
@@ -4079,7 +4367,7 @@ public class MedicationRequest extends DomainResource { */ public static final ca.uhn.fhir.rest.gclient.DateClientParam AUTHOREDON = new ca.uhn.fhir.rest.gclient.DateClientParam(SP_AUTHOREDON); - /** + /** * Search parameter: code *

* Description: Return prescriptions of this medication code
@@ -4087,9 +4375,9 @@ public class MedicationRequest extends DomainResource { * Path: MedicationRequest.medicationCodeableConcept
*

*/ - @SearchParamDefinition(name="code", path="(MedicationRequest.medication as CodeableConcept)", description="Return prescriptions of this medication code", type="token" ) + @SearchParamDefinition(name = "code", path = "(MedicationRequest.medication as CodeableConcept)", description = "Return prescriptions of this medication code", type = "token") public static final String SP_CODE = "code"; - /** + /** * Fluent Client search parameter constant for code *

* Description: Return prescriptions of this medication code
@@ -4099,7 +4387,7 @@ public class MedicationRequest extends DomainResource { */ public static final ca.uhn.fhir.rest.gclient.TokenClientParam CODE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CODE); - /** + /** * Search parameter: subject *

* Description: The identity of a patient to list orders for
@@ -4107,9 +4395,9 @@ public class MedicationRequest extends DomainResource { * Path: MedicationRequest.subject
*

*/ - @SearchParamDefinition(name="subject", path="MedicationRequest.subject", description="The identity of a patient to list orders for", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Patient") }, target={Group.class, Patient.class } ) + @SearchParamDefinition(name = "subject", path = "MedicationRequest.subject", description = "The identity of a patient to list orders for", type = "reference", providesMembershipIn = {@ca.uhn.fhir.model.api.annotation.Compartment(name = "Patient")}, target = {Group.class, Patient.class}) public static final String SP_SUBJECT = "subject"; - /** + /** * Fluent Client search parameter constant for subject *

* Description: The identity of a patient to list orders for
@@ -4119,13 +4407,13 @@ public class MedicationRequest extends DomainResource { */ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam SUBJECT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_SUBJECT); -/** + /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "MedicationRequest:subject". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_SUBJECT = new ca.uhn.fhir.model.api.Include("MedicationRequest:subject").toLocked(); - /** + /** * Search parameter: medication *

* Description: Return prescriptions for this medication reference
@@ -4133,9 +4421,9 @@ public class MedicationRequest extends DomainResource { * Path: MedicationRequest.medicationReference
*

*/ - @SearchParamDefinition(name="medication", path="(MedicationRequest.medication as Reference)", description="Return prescriptions for this medication reference", type="reference", target={Medication.class } ) + @SearchParamDefinition(name = "medication", path = "(MedicationRequest.medication as Reference)", description = "Return prescriptions for this medication reference", type = "reference", target = {Medication.class}) public static final String SP_MEDICATION = "medication"; - /** + /** * Fluent Client search parameter constant for medication *

* Description: Return prescriptions for this medication reference
@@ -4145,13 +4433,13 @@ public class MedicationRequest extends DomainResource { */ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam MEDICATION = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_MEDICATION); -/** + /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "MedicationRequest:medication". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_MEDICATION = new ca.uhn.fhir.model.api.Include("MedicationRequest:medication").toLocked(); - /** + /** * Search parameter: encounter *

* Description: Return prescriptions with this encounter identifier
@@ -4159,9 +4447,9 @@ public class MedicationRequest extends DomainResource { * Path: MedicationRequest.encounter
*

*/ - @SearchParamDefinition(name="encounter", path="MedicationRequest.encounter", description="Return prescriptions with this encounter identifier", type="reference", providesMembershipIn={ @ca.uhn.fhir.model.api.annotation.Compartment(name="Encounter") }, target={Encounter.class } ) + @SearchParamDefinition(name = "encounter", path = "MedicationRequest.encounter", description = "Return prescriptions with this encounter identifier", type = "reference", providesMembershipIn = {@ca.uhn.fhir.model.api.annotation.Compartment(name = "Encounter")}, target = {Encounter.class}) public static final String SP_ENCOUNTER = "encounter"; - /** + /** * Fluent Client search parameter constant for encounter *

* Description: Return prescriptions with this encounter identifier
@@ -4171,13 +4459,13 @@ public class MedicationRequest extends DomainResource { */ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam ENCOUNTER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_ENCOUNTER); -/** + /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "MedicationRequest:encounter". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_ENCOUNTER = new ca.uhn.fhir.model.api.Include("MedicationRequest:encounter").toLocked(); - /** + /** * Search parameter: priority *

* Description: Returns prescriptions with different priorities
@@ -4185,9 +4473,9 @@ public class MedicationRequest extends DomainResource { * Path: MedicationRequest.priority
*

*/ - @SearchParamDefinition(name="priority", path="MedicationRequest.priority", description="Returns prescriptions with different priorities", type="token" ) + @SearchParamDefinition(name = "priority", path = "MedicationRequest.priority", description = "Returns prescriptions with different priorities", type = "token") public static final String SP_PRIORITY = "priority"; - /** + /** * Fluent Client search parameter constant for priority *

* Description: Returns prescriptions with different priorities
@@ -4197,7 +4485,7 @@ public class MedicationRequest extends DomainResource { */ public static final ca.uhn.fhir.rest.gclient.TokenClientParam PRIORITY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_PRIORITY); - /** + /** * Search parameter: intent *

* Description: Returns prescriptions with different intents
@@ -4205,9 +4493,9 @@ public class MedicationRequest extends DomainResource { * Path: MedicationRequest.intent
*

*/ - @SearchParamDefinition(name="intent", path="MedicationRequest.intent", description="Returns prescriptions with different intents", type="token" ) + @SearchParamDefinition(name = "intent", path = "MedicationRequest.intent", description = "Returns prescriptions with different intents", type = "token") public static final String SP_INTENT = "intent"; - /** + /** * Fluent Client search parameter constant for intent *

* Description: Returns prescriptions with different intents
@@ -4217,7 +4505,7 @@ public class MedicationRequest extends DomainResource { */ public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENT = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INTENT); - /** + /** * Search parameter: patient *

* Description: Returns prescriptions for a specific patient
@@ -4225,9 +4513,9 @@ public class MedicationRequest extends DomainResource { * Path: MedicationRequest.subject
*

*/ - @SearchParamDefinition(name="patient", path="MedicationRequest.subject.where(resolve() is Patient)", description="Returns prescriptions for a specific patient", type="reference", target={Patient.class } ) + @SearchParamDefinition(name = "patient", path = "MedicationRequest.subject.where(resolve() is Patient)", description = "Returns prescriptions for a specific patient", type = "reference", target = {Patient.class}) public static final String SP_PATIENT = "patient"; - /** + /** * Fluent Client search parameter constant for patient *

* Description: Returns prescriptions for a specific patient
@@ -4237,13 +4525,13 @@ public class MedicationRequest extends DomainResource { */ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam PATIENT = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_PATIENT); -/** + /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "MedicationRequest:patient". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_PATIENT = new ca.uhn.fhir.model.api.Include("MedicationRequest:patient").toLocked(); - /** + /** * Search parameter: intended-performer *

* Description: Returns the intended performer of the administration of the medication request
@@ -4251,9 +4539,9 @@ public class MedicationRequest extends DomainResource { * Path: MedicationRequest.performer
*

*/ - @SearchParamDefinition(name="intended-performer", path="MedicationRequest.performer", description="Returns the intended performer of the administration of the medication request", type="reference", target={CareTeam.class, Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class } ) + @SearchParamDefinition(name = "intended-performer", path = "MedicationRequest.performer", description = "Returns the intended performer of the administration of the medication request", type = "reference", target = {CareTeam.class, Device.class, Organization.class, Patient.class, Practitioner.class, PractitionerRole.class, RelatedPerson.class}) public static final String SP_INTENDED_PERFORMER = "intended-performer"; - /** + /** * Fluent Client search parameter constant for intended-performer *

* Description: Returns the intended performer of the administration of the medication request
@@ -4263,13 +4551,13 @@ public class MedicationRequest extends DomainResource { */ public static final ca.uhn.fhir.rest.gclient.ReferenceClientParam INTENDED_PERFORMER = new ca.uhn.fhir.rest.gclient.ReferenceClientParam(SP_INTENDED_PERFORMER); -/** + /** * Constant for fluent queries to be used to add include statements. Specifies * the path value of "MedicationRequest:intended-performer". */ public static final ca.uhn.fhir.model.api.Include INCLUDE_INTENDED_PERFORMER = new ca.uhn.fhir.model.api.Include("MedicationRequest:intended-performer").toLocked(); - /** + /** * Search parameter: intended-performertype *

* Description: Returns requests for a specific type of performer
@@ -4277,9 +4565,9 @@ public class MedicationRequest extends DomainResource { * Path: MedicationRequest.performerType
*

*/ - @SearchParamDefinition(name="intended-performertype", path="MedicationRequest.performerType", description="Returns requests for a specific type of performer", type="token" ) + @SearchParamDefinition(name = "intended-performertype", path = "MedicationRequest.performerType", description = "Returns requests for a specific type of performer", type = "token") public static final String SP_INTENDED_PERFORMERTYPE = "intended-performertype"; - /** + /** * Fluent Client search parameter constant for intended-performertype *

* Description: Returns requests for a specific type of performer
@@ -4289,7 +4577,7 @@ public class MedicationRequest extends DomainResource { */ public static final ca.uhn.fhir.rest.gclient.TokenClientParam INTENDED_PERFORMERTYPE = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_INTENDED_PERFORMERTYPE); - /** + /** * Search parameter: category *

* Description: Returns prescriptions with different categories
@@ -4297,9 +4585,9 @@ public class MedicationRequest extends DomainResource { * Path: MedicationRequest.category
*

*/ - @SearchParamDefinition(name="category", path="MedicationRequest.category", description="Returns prescriptions with different categories", type="token" ) + @SearchParamDefinition(name = "category", path = "MedicationRequest.category", description = "Returns prescriptions with different categories", type = "token") public static final String SP_CATEGORY = "category"; - /** + /** * Fluent Client search parameter constant for category *

* Description: Returns prescriptions with different categories
@@ -4309,7 +4597,7 @@ public class MedicationRequest extends DomainResource { */ public static final ca.uhn.fhir.rest.gclient.TokenClientParam CATEGORY = new ca.uhn.fhir.rest.gclient.TokenClientParam(SP_CATEGORY); - /** + /** * Search parameter: status *

* Description: Status of the prescription
@@ -4317,9 +4605,9 @@ public class MedicationRequest extends DomainResource { * Path: MedicationRequest.status
*

*/ - @SearchParamDefinition(name="status", path="MedicationRequest.status", description="Status of the prescription", type="token" ) + @SearchParamDefinition(name = "status", path = "MedicationRequest.status", description = "Status of the prescription", type = "token") public static final String SP_STATUS = "status"; - /** + /** * Fluent Client search parameter constant for status *

* Description: Status of the prescription
diff --git a/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/model/BaseDateTimeTypeTest.java b/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/model/BaseDateTimeTypeTest.java index 56858f1bd..af866441c 100644 --- a/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/model/BaseDateTimeTypeTest.java +++ b/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/model/BaseDateTimeTypeTest.java @@ -1,11 +1,8 @@ package org.hl7.fhir.r4.model; -import org.junit.Ignore; -import org.junit.Test; - -import java.util.TimeZone; - -import static org.junit.Assert.*; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; public class BaseDateTimeTypeTest { @@ -19,52 +16,52 @@ public class BaseDateTimeTypeTest { * */ @Test - @Ignore + @Disabled public void equalsUsingFhirPathRules() { // Exact same - Same timezone - assertTrue(compareDateTimes("2001-01-02T11:22:33.444Z", "2001-01-02T11:22:33.444Z")); + Assertions.assertTrue(compareDateTimes("2001-01-02T11:22:33.444Z", "2001-01-02T11:22:33.444Z")); // Exact same - Different timezone - assertTrue(compareDateTimes("2001-01-02T11:22:33.444-03:00", "2001-01-02T10:22:33.444-04:00")); + Assertions.assertTrue(compareDateTimes("2001-01-02T11:22:33.444-03:00", "2001-01-02T10:22:33.444-04:00")); // Exact same - Dates - assertTrue(compareDateTimes("2001", "2001")); - assertTrue(compareDateTimes("2001-01", "2001-01")); - assertTrue(compareDateTimes("2001-01-02", "2001-01-02")); + Assertions.assertTrue(compareDateTimes("2001", "2001")); + Assertions.assertTrue(compareDateTimes("2001-01", "2001-01")); + Assertions.assertTrue(compareDateTimes("2001-01-02", "2001-01-02")); // Same precision but different values - Dates - assertFalse(compareDateTimes("2001", "2002")); - assertFalse(compareDateTimes("2001-01", "2001-02")); - assertFalse(compareDateTimes("2001-01-02", "2001-01-03")); + Assertions.assertFalse(compareDateTimes("2001", "2002")); + Assertions.assertFalse(compareDateTimes("2001-01", "2001-02")); + Assertions.assertFalse(compareDateTimes("2001-01-02", "2001-01-03")); // Different instant - Same timezone - assertFalse(compareDateTimes("2001-01-02T11:22:33.444Z", "2001-01-02T11:22:33.445Z")); - assertFalse(compareDateTimes("2001-01-02T11:22:33.445Z", "2001-01-02T11:22:33.444Z")); + Assertions.assertFalse(compareDateTimes("2001-01-02T11:22:33.444Z", "2001-01-02T11:22:33.445Z")); + Assertions.assertFalse(compareDateTimes("2001-01-02T11:22:33.445Z", "2001-01-02T11:22:33.444Z")); // FHIRPath tests: - assertFalse(compareDateTimes("1974-12-25", "1974-12-25T12:34:00+10:00")); - assertFalse(compareDateTimes("1974-12-25T12:34:00+10:00", "1974-12-25")); - assertFalse(compareDateTimes("1974-12-25", "1974-12-25T12:34:00-10:00")); - assertFalse(compareDateTimes("1974-12-25T12:34:00-10:00", "1974-12-25")); - assertFalse(compareDateTimes("1974-12-25", "1974-12-25T12:34:00Z")); - assertFalse(compareDateTimes("1974-12-25T12:34:00Z", "1974-12-25")); - assertFalse(compareDateTimes("2012-04-15", "2012-04-16")); - assertFalse(compareDateTimes("2012-04-16", "2012-04-15")); - assertFalse(compareDateTimes("2012-04-15T15:00:00", "2012-04-15T10:00:00")); - assertFalse(compareDateTimes("2012-04-15T10:00:00", "2012-04-15T15:00:00")); - assertFalse(compareDateTimes("2017-11-05T01:30:00.0-04:00", "2017-11-05T01:15:00.0-05:00")); - assertFalse(compareDateTimes("2017-11-05T01:15:00.0-05:00", "2017-11-05T01:30:00.0-04:00")); - assertNull(compareDateTimes("1974-12-25", "1974-12-25T12:34:00")); - assertNull(compareDateTimes("1974-12-25T12:34:00", "1974-12-25")); - assertNull(compareDateTimes("2012-04-15T10:00:00", "2012-04-15")); - assertNull(compareDateTimes("2012-04-15T15:00:00Z", "2012-04-15T10:00:00")); - assertNull(compareDateTimes("2012-04-15T10:00:00", "2012-04-15T15:00:00Z")); - assertTrue(compareDateTimes("1974-12-25", "1974-12-25")); - assertTrue(compareDateTimes("2012-04-15", "2012-04-15")); - assertTrue(compareDateTimes("2012-04-15T15:00:00+02:00", "2012-04-15T16:00:00+03:00")); - assertTrue(compareDateTimes("2012-04-15T16:00:00+03:00", "2012-04-15T15:00:00+02:00")); - assertTrue(compareDateTimes("2017-11-05T01:30:00.0-04:00", "2017-11-05T00:30:00.0-05:00")); - assertTrue(compareDateTimes("2017-11-05T00:30:00.0-05:00", "2017-11-05T01:30:00.0-04:00")); + Assertions.assertFalse(compareDateTimes("1974-12-25", "1974-12-25T12:34:00+10:00")); + Assertions.assertFalse(compareDateTimes("1974-12-25T12:34:00+10:00", "1974-12-25")); + Assertions.assertFalse(compareDateTimes("1974-12-25", "1974-12-25T12:34:00-10:00")); + Assertions.assertFalse(compareDateTimes("1974-12-25T12:34:00-10:00", "1974-12-25")); + Assertions.assertFalse(compareDateTimes("1974-12-25", "1974-12-25T12:34:00Z")); + Assertions.assertFalse(compareDateTimes("1974-12-25T12:34:00Z", "1974-12-25")); + Assertions.assertFalse(compareDateTimes("2012-04-15", "2012-04-16")); + Assertions.assertFalse(compareDateTimes("2012-04-16", "2012-04-15")); + Assertions.assertFalse(compareDateTimes("2012-04-15T15:00:00", "2012-04-15T10:00:00")); + Assertions.assertFalse(compareDateTimes("2012-04-15T10:00:00", "2012-04-15T15:00:00")); + Assertions.assertFalse(compareDateTimes("2017-11-05T01:30:00.0-04:00", "2017-11-05T01:15:00.0-05:00")); + Assertions.assertFalse(compareDateTimes("2017-11-05T01:15:00.0-05:00", "2017-11-05T01:30:00.0-04:00")); + Assertions.assertNull(compareDateTimes("1974-12-25", "1974-12-25T12:34:00")); + Assertions.assertNull(compareDateTimes("1974-12-25T12:34:00", "1974-12-25")); + Assertions.assertNull(compareDateTimes("2012-04-15T10:00:00", "2012-04-15")); + Assertions.assertNull(compareDateTimes("2012-04-15T15:00:00Z", "2012-04-15T10:00:00")); + Assertions.assertNull(compareDateTimes("2012-04-15T10:00:00", "2012-04-15T15:00:00Z")); + Assertions.assertTrue(compareDateTimes("1974-12-25", "1974-12-25")); + Assertions.assertTrue(compareDateTimes("2012-04-15", "2012-04-15")); + Assertions.assertTrue(compareDateTimes("2012-04-15T15:00:00+02:00", "2012-04-15T16:00:00+03:00")); + Assertions.assertTrue(compareDateTimes("2012-04-15T16:00:00+03:00", "2012-04-15T15:00:00+02:00")); + Assertions.assertTrue(compareDateTimes("2017-11-05T01:30:00.0-04:00", "2017-11-05T00:30:00.0-05:00")); + Assertions.assertTrue(compareDateTimes("2017-11-05T00:30:00.0-05:00", "2017-11-05T01:30:00.0-04:00")); - assertFalse(compareDateTimes("2016-12-02T13:00:00Z", "2016-11-02T10:00:00")); // no timezone, but cannot be the same time - assertNull(compareDateTimes("2016-12-02T13:00:00Z", "2016-12-02T10:00:00")); // no timezone, might be the same time + Assertions.assertFalse(compareDateTimes("2016-12-02T13:00:00Z", "2016-11-02T10:00:00")); // no timezone, but cannot be the same time + Assertions.assertNull(compareDateTimes("2016-12-02T13:00:00Z", "2016-12-02T10:00:00")); // no timezone, might be the same time } private Boolean compareDateTimes(String theLeft, String theRight) { diff --git a/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/FHIRPathTests.java b/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/FHIRPathTests.java index 66658100c..146ece405 100644 --- a/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/FHIRPathTests.java +++ b/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/FHIRPathTests.java @@ -1,6 +1,5 @@ package org.hl7.fhir.r4.test; -import junit.framework.Assert; import org.apache.commons.lang3.NotImplementedException; import org.fhir.ucum.UcumException; import org.hl7.fhir.exceptions.FHIRException; @@ -12,6 +11,7 @@ import org.hl7.fhir.r4.utils.FHIRPathEngine; import org.hl7.fhir.r4.utils.FHIRPathEngine.IEvaluationContext; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.xml.XMLUtil; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.TestInstance; @@ -34,7 +34,6 @@ import java.util.Map; import java.util.stream.Stream; @Disabled -@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class FHIRPathTests { public class FHIRPathTestEvaluationServices implements IEvaluationContext { @@ -93,7 +92,7 @@ public class FHIRPathTests { private static FHIRPathEngine fp; @BeforeAll - public void setup() { + public static void setup() { fp = new FHIRPathEngine(TestingUtilities.context()); } @@ -161,9 +160,9 @@ public class FHIRPathTests { fp.check(res, res.getResourceType().toString(), res.getResourceType().toString(), node); } outcome = fp.evaluate(res, node); - Assert.assertTrue(String.format("Expected exception parsing %s", expression), !fail); + Assertions.assertFalse(fail, String.format("Expected exception parsing %s", expression)); } catch (Exception e) { - Assert.assertTrue(String.format("Unexpected exception parsing %s: " + e.getMessage(), expression), fail); + Assertions.assertTrue(fail, String.format("Unexpected exception parsing %s: " + e.getMessage(), expression)); } if ("true".equals(test.getAttribute("predicate"))) { @@ -176,7 +175,7 @@ public class FHIRPathTests { List expected = new ArrayList(); XMLUtil.getNamedChildren(test, "output", expected); - Assert.assertTrue(String.format("Expected %d objects but found %d for expression %s", expected.size(), outcome.size(), expression), outcome.size() == expected.size()); + Assertions.assertEquals(outcome.size(), expected.size(), String.format("Expected %d objects but found %d for expression %s", expected.size(), outcome.size(), expression)); if ("false".equals(test.getAttribute("ordered"))) { for (int i = 0; i < Math.min(outcome.size(), expected.size()); i++) { String tn = outcome.get(i).fhirType(); @@ -191,22 +190,22 @@ public class FHIRPathTests { (Utilities.noString(e.getTextContent()) || e.getTextContent().equals(s))) found = true; } - Assert.assertTrue(String.format("Outcome %d: Value %s of type %s not expected for %s", i, s, tn, expression), found); + Assertions.assertTrue(found, String.format("Outcome %d: Value %s of type %s not expected for %s", i, s, tn, expression)); } } else { for (int i = 0; i < Math.min(outcome.size(), expected.size()); i++) { String tn = expected.get(i).getAttribute("type"); if (!Utilities.noString(tn)) { - Assert.assertTrue(String.format("Outcome %d: Type should be %s but was %s", i, tn, outcome.get(i).fhirType()), tn.equals(outcome.get(i).fhirType())); + Assertions.assertEquals(tn, outcome.get(i).fhirType(), String.format("Outcome %d: Type should be %s but was %s", i, tn, outcome.get(i).fhirType())); } String v = expected.get(i).getTextContent(); if (!Utilities.noString(v)) { if (outcome.get(i) instanceof Quantity) { Quantity q = fp.parseQuantityString(v); - Assert.assertTrue(String.format("Outcome %d: Value should be %s but was %s", i, v, outcome.get(i).toString()), outcome.get(i).equalsDeep(q)); + Assertions.assertTrue(outcome.get(i).equalsDeep(q), String.format("Outcome %d: Value should be %s but was %s", i, v, outcome.get(i).toString())); } else { - Assert.assertTrue(String.format("Outcome %d: Value should be a primitive type but was %s", i, outcome.get(i).fhirType()), outcome.get(i) instanceof PrimitiveType); - Assert.assertTrue(String.format("Outcome %d: Value should be %s but was %s for expression %s", i, v, outcome.get(i).toString(), expression), v.equals(((PrimitiveType) outcome.get(i)).asStringValue())); + Assertions.assertTrue(outcome.get(i) instanceof PrimitiveType, String.format("Outcome %d: Value should be a primitive type but was %s", i, outcome.get(i).fhirType())); + Assertions.assertEquals(v, ((PrimitiveType) outcome.get(i)).asStringValue(), String.format("Outcome %d: Value should be %s but was %s for expression %s", i, v, outcome.get(i).toString(), expression)); } } } diff --git a/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/LiquidEngineTests.java b/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/LiquidEngineTests.java index cdd4fc220..5218cc28a 100644 --- a/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/LiquidEngineTests.java +++ b/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/LiquidEngineTests.java @@ -3,7 +3,6 @@ package org.hl7.fhir.r4.test; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import junit.framework.Assert; import org.apache.commons.collections4.map.HashedMap; import org.hl7.fhir.exceptions.FHIRFormatError; import org.hl7.fhir.r4.formats.XmlParser; @@ -13,12 +12,14 @@ import org.hl7.fhir.r4.utils.LiquidEngine; import org.hl7.fhir.r4.utils.LiquidEngine.ILiquidEngineIcludeResolver; import org.hl7.fhir.r4.utils.LiquidEngine.LiquidDocument; import org.hl7.fhir.utilities.TextFile; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.TestInstance; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; import org.xml.sax.SAXException; import javax.xml.parsers.ParserConfigurationException; @@ -27,8 +28,9 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.stream.Stream; -@RunWith(Parameterized.class) +@Disabled public class LiquidEngineTests implements ILiquidEngineIcludeResolver { private static Map resources = new HashedMap<>(); @@ -37,29 +39,31 @@ public class LiquidEngineTests implements ILiquidEngineIcludeResolver { private JsonObject test; private LiquidEngine engine; - @Parameters(name = "{index}: file{0}") - public static Iterable data() throws ParserConfigurationException, SAXException, IOException { - testdoc = (JsonObject) new com.google.gson.JsonParser().parse(TextFile.fileToString(TestingUtilities.resourceNameToFile("liquid", "liquid-tests.json"))); - JsonArray tests = testdoc.getAsJsonArray("tests"); - List objects = new ArrayList(tests.size()); - for (JsonElement n : tests) { - objects.add(new Object[]{n}); - } - return objects; - } - - public LiquidEngineTests(JsonObject test) { - super(); - this.test = test; - } - - - @Before - public void setUp() throws Exception { + @BeforeEach + public void setUp() { engine = new LiquidEngine(TestingUtilities.context(), null); engine.setIncludeResolver(this); } + public static Stream data() throws ParserConfigurationException, SAXException, IOException { + testdoc = (JsonObject) new com.google.gson.JsonParser().parse(TextFile.fileToString(TestingUtilities.resourceNameToFile("liquid", "liquid-tests.json"))); + JsonArray tests = testdoc.getAsJsonArray("tests"); + List objects = new ArrayList<>(); + for (JsonElement n : tests) { + objects.add(Arguments.of(n)); + } + return objects.stream(); + } + + @ParameterizedTest(name = "{index}: file{0}") + @MethodSource("data") + public void test(JsonObject test) throws Exception { + this.test = test; + LiquidDocument doc = engine.parse(test.get("template").getAsString(), "test-script"); + String output = engine.evaluate(doc, loadResource(), null); + Assertions.assertTrue(test.get("output").getAsString().equals(output)); + } + @Override public String fetchInclude(LiquidEngine engine, String name) { if (test.has("includes") && test.getAsJsonObject("includes").has(name)) @@ -76,14 +80,4 @@ public class LiquidEngineTests implements ILiquidEngineIcludeResolver { } return resources.get(test.get("focus").getAsString()); } - - - @Test - @Ignore - public void test() throws Exception { - LiquidDocument doc = engine.parse(test.get("template").getAsString(), "test-script"); - String output = engine.evaluate(doc, loadResource(), null); - Assert.assertTrue(test.get("output").getAsString().equals(output)); - } - } diff --git a/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/SnapShotGenerationTests.java b/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/SnapShotGenerationTests.java index 52aa612a1..cf4a0b5d8 100644 --- a/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/SnapShotGenerationTests.java +++ b/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/SnapShotGenerationTests.java @@ -1,6 +1,5 @@ package org.hl7.fhir.r4.test; -import junit.framework.Assert; import org.apache.commons.lang3.NotImplementedException; import org.hl7.fhir.exceptions.DefinitionException; import org.hl7.fhir.exceptions.FHIRException; @@ -11,11 +10,15 @@ import org.hl7.fhir.r4.conformance.ProfileUtilities.ProfileKnowledgeProvider; import org.hl7.fhir.r4.formats.IParser.OutputStyle; import org.hl7.fhir.r4.formats.JsonParser; import org.hl7.fhir.r4.formats.XmlParser; -import org.hl7.fhir.r4.model.*; +import org.hl7.fhir.r4.model.Base; import org.hl7.fhir.r4.model.ElementDefinition.ElementDefinitionBindingComponent; import org.hl7.fhir.r4.model.ExpressionNode.CollectionStatus; +import org.hl7.fhir.r4.model.Resource; +import org.hl7.fhir.r4.model.StructureDefinition; import org.hl7.fhir.r4.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r4.model.StructureDefinition.TypeDerivationRule; +import org.hl7.fhir.r4.model.TypeDetails; +import org.hl7.fhir.r4.model.ValueSet; import org.hl7.fhir.r4.test.utils.TestingUtilities; import org.hl7.fhir.r4.utils.FHIRPathEngine; import org.hl7.fhir.r4.utils.FHIRPathEngine.IEvaluationContext; @@ -36,7 +39,11 @@ import org.w3c.dom.Element; import org.xml.sax.SAXException; import javax.xml.parsers.ParserConfigurationException; -import java.io.*; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; @@ -399,9 +406,9 @@ public class SnapShotGenerationTests { testGen(test, context); else testSort(test, context); - Assert.assertTrue("Should have failed", false); + Assertions.assertTrue(false, "Should have failed"); } catch (Throwable e) { - Assert.assertTrue("all ok", true); + Assertions.assertTrue(true, "all ok"); } } else if (test.isGen()) @@ -411,7 +418,7 @@ public class SnapShotGenerationTests { for (Rule r : test.getRules()) { StructureDefinition sdn = new StructureDefinition(); boolean ok = fp.evaluateToBoolean(sdn, sdn, sdn, r.expression); - Assert.assertTrue(r.description, ok); + Assertions.assertTrue(ok, r.description); } } diff --git a/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/misc/StructureMapTests.java b/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/misc/StructureMapTests.java index 7c72074cd..da7772f89 100644 --- a/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/misc/StructureMapTests.java +++ b/org.hl7.fhir.r4/src/test/java/org/hl7/fhir/r4/test/misc/StructureMapTests.java @@ -2,24 +2,20 @@ package org.hl7.fhir.r4.test.misc; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRFormatError; -import org.junit.Ignore; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; import javax.xml.parsers.ParserConfigurationException; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.stream.Stream; -@RunWith(Parameterized.class) public class StructureMapTests { - @Parameters(name = "{index}: file {0}") - public static Iterable data() throws ParserConfigurationException, IOException, FHIRFormatError { - + public static Stream data() throws ParserConfigurationException, IOException, FHIRFormatError { List files = new ArrayList<>(); // File dir = new File(Utilities.path(TestingUtilities.home(), "implementations", "r3maps", "R3toR4")); // for (File f : dir.listFiles()) @@ -29,24 +25,18 @@ public class StructureMapTests { // for (File f : dir.listFiles()) // if (f.getName().endsWith(".map")) // files.add(f.getAbsolutePath()); - List objects = new ArrayList(files.size()); + List objects = new ArrayList<>(); // // for (String fn : files) { // objects.add(new Object[] { new File(fn).getName(), fn }); // } - return objects; - } - - private String filename; - - public StructureMapTests(String name, String filename) { - this.filename = filename; + return objects.stream(); } @SuppressWarnings("deprecation") - @Test - @Ignore - public void test() throws FHIRException, FileNotFoundException, IOException { + @ParameterizedTest(name = "{index}: file {0}") + @MethodSource("data") + public void test(String name, String filename) throws FHIRException, FileNotFoundException, IOException { // if (TestingUtilities.context == null) { // TestingUtilities.context = SimpleWorkerContext.fromPack(Utilities.path(TestingUtilities.content(), "definitions.xml.zip")); // } diff --git a/org.hl7.fhir.r5/pom.xml b/org.hl7.fhir.r5/pom.xml index 3e40965dd..259e782f1 100644 --- a/org.hl7.fhir.r5/pom.xml +++ b/org.hl7.fhir.r5/pom.xml @@ -108,11 +108,17 @@ test - + org.junit.jupiter - junit-jupiter-engine - 5.6.0 + junit-jupiter-api + ${junit_jupiter_version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit_jupiter_version} test diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/test/utils/TestingUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/test/utils/TestingUtilities.java index da94df8d5..0f9d58888 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/test/utils/TestingUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/test/utils/TestingUtilities.java @@ -9,9 +9,9 @@ package org.hl7.fhir.r5.test.utils; * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -20,19 +20,12 @@ package org.hl7.fhir.r5.test.utils; * #L% */ -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; - +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonNull; +import com.google.gson.JsonObject; +import com.google.gson.JsonPrimitive; +import com.google.gson.JsonSyntaxException; import org.apache.commons.codec.binary.Base64; import org.apache.commons.io.IOUtils; import org.fhir.ucum.UcumEssenceService; @@ -45,79 +38,85 @@ import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.VersionUtilities; import org.hl7.fhir.utilities.cache.PackageCacheManager; import org.hl7.fhir.utilities.cache.ToolsVersion; - import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonNull; -import com.google.gson.JsonObject; -import com.google.gson.JsonPrimitive; -import com.google.gson.JsonSyntaxException; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public class TestingUtilities { private static final boolean SHOW_DIFF = true; - - static public Map fcontexts; - + + static public Map fcontexts; + public static IWorkerContext context() { return context("4.0.1"); } - public static IWorkerContext context(String version) { - String v = VersionUtilities.getMajMin(version); + + public static IWorkerContext context(String version) { + String v = VersionUtilities.getMajMin(version); if (fcontexts == null) { fcontexts = new HashMap<>(); } - if (!fcontexts.containsKey(v)) { - PackageCacheManager pcm; - try { - pcm = new PackageCacheManager(true, ToolsVersion.TOOLS_VERSION); - IWorkerContext fcontext = SimpleWorkerContext.fromPackage(pcm.loadPackage(VersionUtilities.packageForVersion(version), version)); - fcontext.setUcumService(new UcumEssenceService(TestingUtilities.loadTestResourceStream("ucum", "ucum-essence.xml"))); - fcontext.setExpansionProfile(new Parameters()); - fcontexts.put(v, fcontext); - } catch (Exception e) { - throw new Error(e); - } - } - return fcontexts.get(v); - } - static public boolean silent; + if (!fcontexts.containsKey(v)) { + PackageCacheManager pcm; + try { + pcm = new PackageCacheManager(true, ToolsVersion.TOOLS_VERSION); + IWorkerContext fcontext = SimpleWorkerContext.fromPackage(pcm.loadPackage(VersionUtilities.packageForVersion(version), version)); + fcontext.setUcumService(new UcumEssenceService(TestingUtilities.loadTestResourceStream("ucum", "ucum-essence.xml"))); + fcontext.setExpansionProfile(new Parameters()); + fcontexts.put(v, fcontext); + } catch (Exception e) { + throw new Error(e); + } + } + return fcontexts.get(v); + } + + static public boolean silent; static public String fixedpath; static public String contentpath; public static String home() { if (fixedpath != null) - return fixedpath; + return fixedpath; String s = System.getenv("FHIR_HOME"); if (!Utilities.noString(s)) return s; s = "C:\\work\\org.hl7.fhir\\build"; // FIXME: change this back - s = "/Users/jamesagnew/git/fhir"; + s = "/Users/jamesagnew/git/fhir"; if (new File(s).exists()) return s; throw new Error("FHIR Home directory not configured"); } - + public static String content() throws IOException { if (contentpath != null) - return contentpath; + return contentpath; String s = "R:\\fhir\\publish"; if (new File(s).exists()) return s; return Utilities.path(home(), "publish"); } - + // diretory that contains all the US implementation guides public static String us() { if (fixedpath != null) - return fixedpath; + return fixedpath; String s = System.getenv("FHIR_HOME"); if (!Utilities.noString(s)) return s; @@ -126,26 +125,26 @@ public class TestingUtilities { return s; throw new Error("FHIR US directory not configured"); } - + public static String checkXMLIsSame(InputStream f1, InputStream f2) throws Exception { String result = compareXml(f1, f2); return result; } - - public static String checkXMLIsSame(String f1, String f2) throws Exception { - String result = compareXml(f1, f2); - if (result != null && SHOW_DIFF) { - String diff = Utilities.path(System.getenv("ProgramFiles(X86)"), "WinMerge", "WinMergeU.exe"); - List command = new ArrayList(); - command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\""); - ProcessBuilder builder = new ProcessBuilder(command); - builder.directory(new CSFile("c:\\temp")); - builder.start(); - - } - return result; - } + public static String checkXMLIsSame(String f1, String f2) throws Exception { + String result = compareXml(f1, f2); + if (result != null && SHOW_DIFF) { + String diff = Utilities.path(System.getenv("ProgramFiles(X86)"), "WinMerge", "WinMergeU.exe"); + List command = new ArrayList(); + command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\""); + + ProcessBuilder builder = new ProcessBuilder(command); + builder.directory(new CSFile("c:\\temp")); + builder.start(); + + } + return result; + } private static String compareXml(InputStream f1, InputStream f2) throws Exception { return compareElements("", loadXml(f1).getDocumentElement(), loadXml(f2).getDocumentElement()); @@ -155,93 +154,92 @@ public class TestingUtilities { return compareElements("", loadXml(f1).getDocumentElement(), loadXml(f2).getDocumentElement()); } - private static String compareElements(String path, Element e1, Element e2) { - if (!e1.getNamespaceURI().equals(e2.getNamespaceURI())) - return "Namespaces differ at "+path+": "+e1.getNamespaceURI()+"/"+e2.getNamespaceURI(); - if (!e1.getLocalName().equals(e2.getLocalName())) - return "Names differ at "+path+": "+e1.getLocalName()+"/"+e2.getLocalName(); - path = path + "/"+e1.getLocalName(); - String s = compareAttributes(path, e1.getAttributes(), e2.getAttributes()); - if (!Utilities.noString(s)) - return s; - s = compareAttributes(path, e2.getAttributes(), e1.getAttributes()); - if (!Utilities.noString(s)) - return s; + private static String compareElements(String path, Element e1, Element e2) { + if (!e1.getNamespaceURI().equals(e2.getNamespaceURI())) + return "Namespaces differ at " + path + ": " + e1.getNamespaceURI() + "/" + e2.getNamespaceURI(); + if (!e1.getLocalName().equals(e2.getLocalName())) + return "Names differ at " + path + ": " + e1.getLocalName() + "/" + e2.getLocalName(); + path = path + "/" + e1.getLocalName(); + String s = compareAttributes(path, e1.getAttributes(), e2.getAttributes()); + if (!Utilities.noString(s)) + return s; + s = compareAttributes(path, e2.getAttributes(), e1.getAttributes()); + if (!Utilities.noString(s)) + return s; - Node c1 = e1.getFirstChild(); - Node c2 = e2.getFirstChild(); - c1 = skipBlankText(c1); - c2 = skipBlankText(c2); - while (c1 != null && c2 != null) { - if (c1.getNodeType() != c2.getNodeType()) - return "node type mismatch in children of "+path+": "+Integer.toString(e1.getNodeType())+"/"+Integer.toString(e2.getNodeType()); - if (c1.getNodeType() == Node.TEXT_NODE) { - if (!normalise(c1.getTextContent()).equals(normalise(c2.getTextContent()))) - return "Text differs at "+path+": "+normalise(c1.getTextContent()) +"/"+ normalise(c2.getTextContent()); - } - else if (c1.getNodeType() == Node.ELEMENT_NODE) { - s = compareElements(path, (Element) c1, (Element) c2); - if (!Utilities.noString(s)) - return s; - } + Node c1 = e1.getFirstChild(); + Node c2 = e2.getFirstChild(); + c1 = skipBlankText(c1); + c2 = skipBlankText(c2); + while (c1 != null && c2 != null) { + if (c1.getNodeType() != c2.getNodeType()) + return "node type mismatch in children of " + path + ": " + Integer.toString(e1.getNodeType()) + "/" + Integer.toString(e2.getNodeType()); + if (c1.getNodeType() == Node.TEXT_NODE) { + if (!normalise(c1.getTextContent()).equals(normalise(c2.getTextContent()))) + return "Text differs at " + path + ": " + normalise(c1.getTextContent()) + "/" + normalise(c2.getTextContent()); + } else if (c1.getNodeType() == Node.ELEMENT_NODE) { + s = compareElements(path, (Element) c1, (Element) c2); + if (!Utilities.noString(s)) + return s; + } - c1 = skipBlankText(c1.getNextSibling()); - c2 = skipBlankText(c2.getNextSibling()); - } - if (c1 != null) - return "node mismatch - more nodes in source in children of "+path; - if (c2 != null) - return "node mismatch - more nodes in target in children of "+path; - return null; - } + c1 = skipBlankText(c1.getNextSibling()); + c2 = skipBlankText(c2.getNextSibling()); + } + if (c1 != null) + return "node mismatch - more nodes in source in children of " + path; + if (c2 != null) + return "node mismatch - more nodes in target in children of " + path; + return null; + } - private static Object normalise(String text) { - String result = text.trim().replace('\r', ' ').replace('\n', ' ').replace('\t', ' '); - while (result.contains(" ")) - result = result.replace(" ", " "); - return result; - } + private static Object normalise(String text) { + String result = text.trim().replace('\r', ' ').replace('\n', ' ').replace('\t', ' '); + while (result.contains(" ")) + result = result.replace(" ", " "); + return result; + } - private static String compareAttributes(String path, NamedNodeMap src, NamedNodeMap tgt) { - for (int i = 0; i < src.getLength(); i++) { - - Node sa = src.item(i); - String sn = sa.getNodeName(); - if (! (sn.equals("xmlns") || sn.startsWith("xmlns:"))) { - Node ta = tgt.getNamedItem(sn); - if (ta == null) - return "Attributes differ at "+path+": missing attribute "+sn; - if (!normalise(sa.getTextContent()).equals(normalise(ta.getTextContent()))) { - byte[] b1 = unBase64(sa.getTextContent()); - byte[] b2 = unBase64(ta.getTextContent()); - if (!sameBytes(b1, b2)) - return "Attributes differ at "+path+": value "+normalise(sa.getTextContent()) +"/"+ normalise(ta.getTextContent()); - } - } - } - return null; - } + private static String compareAttributes(String path, NamedNodeMap src, NamedNodeMap tgt) { + for (int i = 0; i < src.getLength(); i++) { - private static boolean sameBytes(byte[] b1, byte[] b2) { - if (b1.length == 0 || b2.length == 0) - return false; - if (b1.length != b2.length) - return false; - for (int i = 0; i < b1.length; i++) - if (b1[i] != b2[i]) - return false; - return true; - } + Node sa = src.item(i); + String sn = sa.getNodeName(); + if (!(sn.equals("xmlns") || sn.startsWith("xmlns:"))) { + Node ta = tgt.getNamedItem(sn); + if (ta == null) + return "Attributes differ at " + path + ": missing attribute " + sn; + if (!normalise(sa.getTextContent()).equals(normalise(ta.getTextContent()))) { + byte[] b1 = unBase64(sa.getTextContent()); + byte[] b2 = unBase64(ta.getTextContent()); + if (!sameBytes(b1, b2)) + return "Attributes differ at " + path + ": value " + normalise(sa.getTextContent()) + "/" + normalise(ta.getTextContent()); + } + } + } + return null; + } - private static byte[] unBase64(String text) { - return Base64.decodeBase64(text); - } + private static boolean sameBytes(byte[] b1, byte[] b2) { + if (b1.length == 0 || b2.length == 0) + return false; + if (b1.length != b2.length) + return false; + for (int i = 0; i < b1.length; i++) + if (b1[i] != b2[i]) + return false; + return true; + } - private static Node skipBlankText(Node node) { - while (node != null && (((node.getNodeType() == Node.TEXT_NODE) && Utilities.isWhitespace(node.getTextContent())) || (node.getNodeType() == Node.COMMENT_NODE))) - node = node.getNextSibling(); - return node; - } + private static byte[] unBase64(String text) { + return Base64.decodeBase64(text); + } + + private static Node skipBlankText(Node node) { + while (node != null && (((node.getNodeType() == Node.TEXT_NODE) && Utilities.isWhitespace(node.getTextContent())) || (node.getNodeType() == Node.COMMENT_NODE))) + node = node.getNextSibling(); + return node; + } private static Document loadXml(String fn) throws Exception { return loadXml(new FileInputStream(fn)); @@ -249,175 +247,37 @@ public class TestingUtilities { private static Document loadXml(InputStream fn) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); - factory.setFeature("http://xml.org/sax/features/external-general-entities", false); - factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); - factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); - factory.setXIncludeAware(false); - factory.setExpandEntityReferences(false); - + factory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); + factory.setFeature("http://xml.org/sax/features/external-general-entities", false); + factory.setFeature("http://xml.org/sax/features/external-parameter-entities", false); + factory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); + factory.setXIncludeAware(false); + factory.setExpandEntityReferences(false); + factory.setNamespaceAware(true); - DocumentBuilder builder = factory.newDocumentBuilder(); - return builder.parse(fn); + DocumentBuilder builder = factory.newDocumentBuilder(); + return builder.parse(fn); } public static String checkJsonSrcIsSame(String s1, String s2) throws JsonSyntaxException, FileNotFoundException, IOException { - return checkJsonSrcIsSame(s1,s2,true); + return checkJsonSrcIsSame(s1, s2, true); } public static String checkJsonSrcIsSame(String s1, String s2, boolean showDiff) throws JsonSyntaxException, FileNotFoundException, IOException { String result = compareJsonSrc(s1, s2); if (result != null && SHOW_DIFF && showDiff) { - String diff = null; + String diff = null; if (System.getProperty("os.name").contains("Linux")) diff = Utilities.path("/", "usr", "bin", "meld"); else { - if (Utilities.checkFile("WinMerge", Utilities.path(System.getenv("ProgramFiles(X86)"), "WinMerge"), "\\WinMergeU.exe", null)) - diff = Utilities.path(System.getenv("ProgramFiles(X86)"), "WinMerge", "WinMergeU.exe"); - else if (Utilities.checkFile("WinMerge", Utilities.path(System.getenv("ProgramFiles(X86)"), "Meld"), "\\Meld.exe", null)) - diff = Utilities.path(System.getenv("ProgramFiles(X86)"), "Meld", "Meld.exe"); - } - if (diff == null || diff.isEmpty()) - return result; - - List command = new ArrayList(); - String f1 = Utilities.path("[tmp]", "input" + s1.hashCode() + ".json"); - String f2 = Utilities.path("[tmp]", "output" + s2.hashCode() + ".json"); - TextFile.stringToFile(s1, f1); - TextFile.stringToFile(s2, f2); - command.add(diff); - if (diff.toLowerCase().contains("meld")) - command.add("--newtab"); - command.add(f1); - command.add(f2); - - ProcessBuilder builder = new ProcessBuilder(command); - builder.directory(new CSFile(Utilities.path("[tmp]"))); - builder.start(); - - } - return result; - } - public static String checkJsonIsSame(String f1, String f2) throws JsonSyntaxException, FileNotFoundException, IOException { - String result = compareJson(f1, f2); - if (result != null && SHOW_DIFF) { - String diff = Utilities.path(System.getenv("ProgramFiles(X86)"), "WinMerge", "WinMergeU.exe"); - List command = new ArrayList(); - command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\""); - - ProcessBuilder builder = new ProcessBuilder(command); - builder.directory(new CSFile("c:\\temp")); - builder.start(); - - } - return result; - } - - private static String compareJsonSrc(String f1, String f2) throws JsonSyntaxException, FileNotFoundException, IOException { - JsonObject o1 = (JsonObject) new com.google.gson.JsonParser().parse(f1); - JsonObject o2 = (JsonObject) new com.google.gson.JsonParser().parse(f2); - return compareObjects("", o1, o2); - } - - private static String compareJson(String f1, String f2) throws JsonSyntaxException, FileNotFoundException, IOException { - JsonObject o1 = (JsonObject) new com.google.gson.JsonParser().parse(TextFile.fileToString(f1)); - JsonObject o2 = (JsonObject) new com.google.gson.JsonParser().parse(TextFile.fileToString(f2)); - return compareObjects("", o1, o2); - } - - private static String compareObjects(String path, JsonObject o1, JsonObject o2) { - for (Map.Entry en : o1.entrySet()) { - String n = en.getKey(); - if (!n.equals("fhir_comments")) { - if (o2.has(n)) { - String s = compareNodes(path+'.'+n, en.getValue(), o2.get(n)); - if (!Utilities.noString(s)) - return s; - } - else - return "properties differ at "+path+": missing property "+n; - } - } - for (Map.Entry en : o2.entrySet()) { - String n = en.getKey(); - if (!n.equals("fhir_comments")) { - if (!o1.has(n)) - return "properties differ at "+path+": missing property "+n; - } - } - return null; - } - - private static String compareNodes(String path, JsonElement n1, JsonElement n2) { - if (n1.getClass() != n2.getClass()) - return "properties differ at "+path+": type "+n1.getClass().getName()+"/"+n2.getClass().getName(); - else if (n1 instanceof JsonPrimitive) { - JsonPrimitive p1 = (JsonPrimitive) n1; - JsonPrimitive p2 = (JsonPrimitive) n2; - if (p1.isBoolean() && p2.isBoolean()) { - if (p1.getAsBoolean() != p2.getAsBoolean()) - return "boolean property values differ at "+path+": type "+p1.getAsString()+"/"+p2.getAsString(); - } else if (p1.isString() && p2.isString()) { - String s1 = p1.getAsString(); - String s2 = p2.getAsString(); - if (!(s1.contains(" command = new ArrayList(); String f1 = Utilities.path("[tmp]", "input" + s1.hashCode() + ".json"); String f2 = Utilities.path("[tmp]", "output" + s2.hashCode() + ".json"); @@ -432,7 +292,143 @@ public class TestingUtilities { ProcessBuilder builder = new ProcessBuilder(command); builder.directory(new CSFile(Utilities.path("[tmp]"))); builder.start(); - + + } + return result; + } + + public static String checkJsonIsSame(String f1, String f2) throws JsonSyntaxException, FileNotFoundException, IOException { + String result = compareJson(f1, f2); + if (result != null && SHOW_DIFF) { + String diff = Utilities.path(System.getenv("ProgramFiles(X86)"), "WinMerge", "WinMergeU.exe"); + List command = new ArrayList(); + command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\""); + + ProcessBuilder builder = new ProcessBuilder(command); + builder.directory(new CSFile("c:\\temp")); + builder.start(); + + } + return result; + } + + private static String compareJsonSrc(String f1, String f2) throws JsonSyntaxException, FileNotFoundException, IOException { + JsonObject o1 = (JsonObject) new com.google.gson.JsonParser().parse(f1); + JsonObject o2 = (JsonObject) new com.google.gson.JsonParser().parse(f2); + return compareObjects("", o1, o2); + } + + private static String compareJson(String f1, String f2) throws JsonSyntaxException, FileNotFoundException, IOException { + JsonObject o1 = (JsonObject) new com.google.gson.JsonParser().parse(TextFile.fileToString(f1)); + JsonObject o2 = (JsonObject) new com.google.gson.JsonParser().parse(TextFile.fileToString(f2)); + return compareObjects("", o1, o2); + } + + private static String compareObjects(String path, JsonObject o1, JsonObject o2) { + for (Map.Entry en : o1.entrySet()) { + String n = en.getKey(); + if (!n.equals("fhir_comments")) { + if (o2.has(n)) { + String s = compareNodes(path + '.' + n, en.getValue(), o2.get(n)); + if (!Utilities.noString(s)) + return s; + } else + return "properties differ at " + path + ": missing property " + n; + } + } + for (Map.Entry en : o2.entrySet()) { + String n = en.getKey(); + if (!n.equals("fhir_comments")) { + if (!o1.has(n)) + return "properties differ at " + path + ": missing property " + n; + } + } + return null; + } + + private static String compareNodes(String path, JsonElement n1, JsonElement n2) { + if (n1.getClass() != n2.getClass()) + return "properties differ at " + path + ": type " + n1.getClass().getName() + "/" + n2.getClass().getName(); + else if (n1 instanceof JsonPrimitive) { + JsonPrimitive p1 = (JsonPrimitive) n1; + JsonPrimitive p2 = (JsonPrimitive) n2; + if (p1.isBoolean() && p2.isBoolean()) { + if (p1.getAsBoolean() != p2.getAsBoolean()) + return "boolean property values differ at " + path + ": type " + p1.getAsString() + "/" + p2.getAsString(); + } else if (p1.isString() && p2.isString()) { + String s1 = p1.getAsString(); + String s2 = p2.getAsString(); + if (!(s1.contains(" command = new ArrayList(); + String f1 = Utilities.path("[tmp]", "input" + s1.hashCode() + ".json"); + String f2 = Utilities.path("[tmp]", "output" + s2.hashCode() + ".json"); + TextFile.stringToFile(s1, f1); + TextFile.stringToFile(s2, f2); + command.add(diff); + if (diff.toLowerCase().contains("meld")) + command.add("--newtab"); + command.add(f1); + command.add(f2); + + ProcessBuilder builder = new ProcessBuilder(command); + builder.directory(new CSFile(Utilities.path("[tmp]"))); + builder.start(); + } return result; } @@ -441,19 +437,19 @@ public class TestingUtilities { private static String compareText(String s1, String s2) { for (int i = 0; i < Integer.min(s1.length(), s2.length()); i++) { if (s1.charAt(i) != s2.charAt(i)) - return "Strings differ at character "+Integer.toString(i)+": '"+s1.charAt(i) +"' vs '"+s2.charAt(i)+"'"; + return "Strings differ at character " + Integer.toString(i) + ": '" + s1.charAt(i) + "' vs '" + s2.charAt(i) + "'"; } if (s1.length() != s2.length()) - return "Strings differ in length: "+Integer.toString(s1.length())+" vs "+Integer.toString(s2.length())+" but match to the end of the shortest"; + return "Strings differ in length: " + Integer.toString(s1.length()) + " vs " + Integer.toString(s2.length()) + " but match to the end of the shortest"; return null; } - public static boolean findTestResource(String... paths) throws IOException { + public static boolean findTestResource(String... paths) throws IOException { if (new File("../../fhir-test-cases").exists() && isTryToLoadFromFileSystem()) { String n = Utilities.path(System.getProperty("user.dir"), "..", "..", "fhir-test-cases", Utilities.path(paths)); return new File(n).exists(); } else { - String classpath = ("/org/hl7/fhir/testcases/"+ Utilities.pathURL(paths)); + String classpath = ("/org/hl7/fhir/testcases/" + Utilities.pathURL(paths)); try { InputStream inputStream = TestingUtilities.class.getResourceAsStream(classpath); return inputStream != null; @@ -476,7 +472,7 @@ public class TestingUtilities { } else { // resolve from the package String contents; - String classpath = ("/org/hl7/fhir/testcases/"+ Utilities.pathURL(paths)); + String classpath = ("/org/hl7/fhir/testcases/" + Utilities.pathURL(paths)); try (InputStream inputStream = TestingUtilities.class.getResourceAsStream(classpath)) { if (inputStream == null) { throw new IOException("Can't find file on classpath: " + classpath); @@ -492,10 +488,10 @@ public class TestingUtilities { String n = Utilities.path(System.getProperty("user.dir"), "..", "..", "fhir-test-cases", Utilities.path(paths)); return new FileInputStream(n); } else { - String classpath = ("/org/hl7/fhir/testcases/"+ Utilities.pathURL(paths)); + String classpath = ("/org/hl7/fhir/testcases/" + Utilities.pathURL(paths)); InputStream s = TestingUtilities.class.getResourceAsStream(classpath); if (s == null) { - throw new Error("unable to find resource "+classpath); + throw new Error("unable to find resource " + classpath); } return s; } @@ -506,10 +502,10 @@ public class TestingUtilities { String n = Utilities.path(System.getProperty("user.dir"), "..", "..", "fhir-test-cases", Utilities.path(paths)); return TextFile.fileToBytes(n); } else { - String classpath = ("/org/hl7/fhir/testcases/"+ Utilities.pathURL(paths)); + String classpath = ("/org/hl7/fhir/testcases/" + Utilities.pathURL(paths)); InputStream s = TestingUtilities.class.getResourceAsStream(classpath); if (s == null) { - throw new Error("unable to find resource "+classpath); + throw new Error("unable to find resource " + classpath); } return TextFile.streamToBytes(s); } @@ -520,7 +516,7 @@ public class TestingUtilities { String tmp = tempFolder(folder); return Utilities.path(tmp, name); } - + public static String tempFolder(String name) throws IOException { File tmp = new File("C:\\temp"); if (tmp.exists() && tmp.isDirectory()) { diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/model/BaseDateTimeTypeTest.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/model/BaseDateTimeTypeTest.java index 242551809..ca1edcff4 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/model/BaseDateTimeTypeTest.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/model/BaseDateTimeTypeTest.java @@ -1,110 +1,108 @@ package org.hl7.fhir.r5.model; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; -import java.util.Date; import java.util.TimeZone; -import static org.junit.Assert.*; - public class BaseDateTimeTypeTest { - /** - *

    - *
  • true if the given datetimes represent the exact same instant with the same precision (irrespective of the timezone)
  • - *
  • true if the given datetimes represent the exact same instant but one includes milliseconds of .[0]+ while the other includes only SECONDS precision (irrespecitve of the timezone)
  • - *
  • true if the given datetimes represent the exact same year/year-month/year-month-date (if both operands have the same precision)
  • - *
  • false if the given datetimes have the same precision but do not represent the same instant (irrespective of timezone)
  • - *
  • null otherwise (since these datetimes are not comparable)
  • - *
- */ - @Test - public void equalsUsingFhirPathRulesInSpec() { - - // from the spec - assertTrue( compareDateTimes("2012", "2012")); - assertFalse(compareDateTimes("2012", "2013")); - assertNull( compareDateTimes("2012-01", "2012")); - assertNull( compareDateTimes("2012-01-01", "2012-01-01T00:00:00")); - assertTrue( compareDateTimes("2012-01-01T10:30:00", "2012-01-01T10:30:00")); - assertFalse(compareDateTimes("2012-01-01T10:30:00", "2012-01-01T10:31:00")); - assertTrue( compareDateTimes("2012-01-01T10:30:31.0", "2012-01-01T10:30:31")); - assertFalse(compareDateTimes("2012-01-01T10:30:31.1", "2012-01-01T10:30:31")); - assertFalse(compareDateTimes("2017-11-05T01:30:00.0-04:00", "2017-11-05T01:15:00.0-05:00")); - assertTrue(compareDateTimes("2017-11-05T01:30:00.0-04:00", "2017-11-05T00:30:00.0-05:00")); - } - - @Test - public void equalsUsingFhirPathRulesOther() { - // Setting timezone for this test. Grahame is in UTC+11, Travis is in GMT, and I'm here in Toronto, Canada with - // all my time based tests failing locally... - TimeZone.setDefault(TimeZone.getTimeZone("UTC+1100")); + /** + *
    + *
  • true if the given datetimes represent the exact same instant with the same precision (irrespective of the timezone)
  • + *
  • true if the given datetimes represent the exact same instant but one includes milliseconds of .[0]+ while the other includes only SECONDS precision (irrespecitve of the timezone)
  • + *
  • true if the given datetimes represent the exact same year/year-month/year-month-date (if both operands have the same precision)
  • + *
  • false if the given datetimes have the same precision but do not represent the same instant (irrespective of timezone)
  • + *
  • null otherwise (since these datetimes are not comparable)
  • + *
+ */ + @Test + public void equalsUsingFhirPathRulesInSpec() { - // Exact same - Same timezone - assertTrue( compareDateTimes("2001-01-02T11:22:33.444Z", "2001-01-02T11:22:33.444Z")); - // Exact same - Different timezone - assertTrue( compareDateTimes("2001-01-02T11:22:33.444-03:00", "2001-01-02T10:22:33.444-04:00")); - // Exact same - Dates - assertTrue( compareDateTimes("2001", "2001")); - assertTrue( compareDateTimes("2001-01", "2001-01")); - assertTrue( compareDateTimes("2001-01-02", "2001-01-02")); - // Same precision but different values - Dates - assertFalse(compareDateTimes("2001", "2002")); - assertFalse(compareDateTimes("2001-01", "2001-02")); - assertFalse(compareDateTimes("2001-01-02", "2001-01-03")); - // Different instant - Same timezone - assertFalse(compareDateTimes("2001-01-02T11:22:33.444Z", "2001-01-02T11:22:33.445Z")); - assertFalse(compareDateTimes("2001-01-02T11:22:33.445Z", "2001-01-02T11:22:33.444Z")); + // from the spec + Assertions.assertTrue(compareDateTimes("2012", "2012")); + Assertions.assertFalse(compareDateTimes("2012", "2013")); + Assertions.assertNull(compareDateTimes("2012-01", "2012")); + Assertions.assertNull(compareDateTimes("2012-01-01", "2012-01-01T00:00:00")); + Assertions.assertTrue(compareDateTimes("2012-01-01T10:30:00", "2012-01-01T10:30:00")); + Assertions.assertFalse(compareDateTimes("2012-01-01T10:30:00", "2012-01-01T10:31:00")); + Assertions.assertTrue(compareDateTimes("2012-01-01T10:30:31.0", "2012-01-01T10:30:31")); + Assertions.assertFalse(compareDateTimes("2012-01-01T10:30:31.1", "2012-01-01T10:30:31")); + Assertions.assertFalse(compareDateTimes("2017-11-05T01:30:00.0-04:00", "2017-11-05T01:15:00.0-05:00")); + Assertions.assertTrue(compareDateTimes("2017-11-05T01:30:00.0-04:00", "2017-11-05T00:30:00.0-05:00")); + } - // FHIRPath tests: - assertNull( compareDateTimes("1974-12-25", "1974-12-25T12:34:00+10:00")); - assertNull( compareDateTimes("1974-12-25T12:34:00+10:00", "1974-12-25")); - assertFalse(compareDateTimes("1974-12-25", "1974-12-23T12:34:00+10:00")); // false because they can't be the same date irrespective of precision - assertFalse(compareDateTimes("1974-12-23T12:34:00+10:00", "1974-12-25")); - assertNull( compareDateTimes("1974-12-25", "1974-12-25T12:34:00Z")); - assertNull( compareDateTimes("1974-12-25T12:34:00Z", "1974-12-25")); - assertFalse(compareDateTimes("2012-04-15", "2012-04-16")); - assertFalse(compareDateTimes("2012-04-16", "2012-04-15")); - assertFalse(compareDateTimes("2012-04-15T15:00:00", "2012-04-15T10:00:00")); - assertFalse(compareDateTimes("2012-04-15T10:00:00", "2012-04-15T15:00:00")); - assertFalse(compareDateTimes("2017-11-05T01:30:00.0-04:00", "2017-11-05T01:15:00.0-05:00")); - assertFalse(compareDateTimes("2017-11-05T01:15:00.0-05:00", "2017-11-05T01:30:00.0-04:00")); - assertNull(compareDateTimes("1974-12-25", "1974-12-25T12:34:00")); - assertNull(compareDateTimes("1974-12-25T12:34:00", "1974-12-25")); - assertNull(compareDateTimes("2012-04-15T10:00:00", "2012-04-15")); - assertFalse(compareDateTimes("2012-04-15T15:00:00Z", "2012-04-15T10:00:00")); - assertFalse(compareDateTimes("2012-04-15T10:00:00", "2012-04-15T15:00:00Z")); - assertTrue(compareDateTimes("1974-12-25", "1974-12-25")); - assertTrue(compareDateTimes("2012-04-15", "2012-04-15")); - assertTrue(compareDateTimes("2012-04-15T15:00:00+02:00", "2012-04-15T16:00:00+03:00")); - assertTrue(compareDateTimes("2012-04-15T16:00:00+03:00", "2012-04-15T15:00:00+02:00")); - assertTrue(compareDateTimes("2017-11-05T01:30:00.0-04:00", "2017-11-05T00:30:00.0-05:00")); - assertTrue(compareDateTimes("2017-11-05T00:30:00.0-05:00", "2017-11-05T01:30:00.0-04:00")); + @Test + public void equalsUsingFhirPathRulesOther() { + // Setting timezone for this test. Grahame is in UTC+11, Travis is in GMT, and I'm here in Toronto, Canada with + // all my time based tests failing locally... + TimeZone.setDefault(TimeZone.getTimeZone("UTC+1100")); - assertFalse(compareDateTimes("2016-12-02T13:00:00Z", "2016-11-02T10:00:00")); // no timezone, but cannot be the same time - assertFalse(compareDateTimes("2016-12-02T13:00:00Z", "2016-12-02T10:00:00")); // no timezone, might be the same time - } + // Exact same - Same timezone + Assertions.assertTrue(compareDateTimes("2001-01-02T11:22:33.444Z", "2001-01-02T11:22:33.444Z")); + // Exact same - Different timezone + Assertions.assertTrue(compareDateTimes("2001-01-02T11:22:33.444-03:00", "2001-01-02T10:22:33.444-04:00")); + // Exact same - Dates + Assertions.assertTrue(compareDateTimes("2001", "2001")); + Assertions.assertTrue(compareDateTimes("2001-01", "2001-01")); + Assertions.assertTrue(compareDateTimes("2001-01-02", "2001-01-02")); + // Same precision but different values - Dates + Assertions.assertFalse(compareDateTimes("2001", "2002")); + Assertions.assertFalse(compareDateTimes("2001-01", "2001-02")); + Assertions.assertFalse(compareDateTimes("2001-01-02", "2001-01-03")); + // Different instant - Same timezone + Assertions.assertFalse(compareDateTimes("2001-01-02T11:22:33.444Z", "2001-01-02T11:22:33.445Z")); + Assertions.assertFalse(compareDateTimes("2001-01-02T11:22:33.445Z", "2001-01-02T11:22:33.444Z")); - @Test - public void testToHumanDisplayForDateOnlyPrecisions() { - assertEquals("2019-01-02", new DateTimeType("2019-01-02").toHumanDisplay()); - assertEquals("2019-01", new DateTimeType("2019-01").toHumanDisplay()); - assertEquals("2019", new DateTimeType("2019").toHumanDisplay()); - } + // FHIRPath tests: + Assertions.assertNull(compareDateTimes("1974-12-25", "1974-12-25T12:34:00+10:00")); + Assertions.assertNull(compareDateTimes("1974-12-25T12:34:00+10:00", "1974-12-25")); + Assertions.assertFalse(compareDateTimes("1974-12-25", "1974-12-23T12:34:00+10:00")); // false because they can't be the same date irrespective of precision + Assertions.assertFalse(compareDateTimes("1974-12-23T12:34:00+10:00", "1974-12-25")); + Assertions.assertNull(compareDateTimes("1974-12-25", "1974-12-25T12:34:00Z")); + Assertions.assertNull(compareDateTimes("1974-12-25T12:34:00Z", "1974-12-25")); + Assertions.assertFalse(compareDateTimes("2012-04-15", "2012-04-16")); + Assertions.assertFalse(compareDateTimes("2012-04-16", "2012-04-15")); + Assertions.assertFalse(compareDateTimes("2012-04-15T15:00:00", "2012-04-15T10:00:00")); + Assertions.assertFalse(compareDateTimes("2012-04-15T10:00:00", "2012-04-15T15:00:00")); + Assertions.assertFalse(compareDateTimes("2017-11-05T01:30:00.0-04:00", "2017-11-05T01:15:00.0-05:00")); + Assertions.assertFalse(compareDateTimes("2017-11-05T01:15:00.0-05:00", "2017-11-05T01:30:00.0-04:00")); + Assertions.assertNull(compareDateTimes("1974-12-25", "1974-12-25T12:34:00")); + Assertions.assertNull(compareDateTimes("1974-12-25T12:34:00", "1974-12-25")); + Assertions.assertNull(compareDateTimes("2012-04-15T10:00:00", "2012-04-15")); + Assertions.assertFalse(compareDateTimes("2012-04-15T15:00:00Z", "2012-04-15T10:00:00")); + Assertions.assertFalse(compareDateTimes("2012-04-15T10:00:00", "2012-04-15T15:00:00Z")); + Assertions.assertTrue(compareDateTimes("1974-12-25", "1974-12-25")); + Assertions.assertTrue(compareDateTimes("2012-04-15", "2012-04-15")); + Assertions.assertTrue(compareDateTimes("2012-04-15T15:00:00+02:00", "2012-04-15T16:00:00+03:00")); + Assertions.assertTrue(compareDateTimes("2012-04-15T16:00:00+03:00", "2012-04-15T15:00:00+02:00")); + Assertions.assertTrue(compareDateTimes("2017-11-05T01:30:00.0-04:00", "2017-11-05T00:30:00.0-05:00")); + Assertions.assertTrue(compareDateTimes("2017-11-05T00:30:00.0-05:00", "2017-11-05T01:30:00.0-04:00")); + + Assertions.assertFalse(compareDateTimes("2016-12-02T13:00:00Z", "2016-11-02T10:00:00")); // no timezone, but cannot be the same time + Assertions.assertFalse(compareDateTimes("2016-12-02T13:00:00Z", "2016-12-02T10:00:00")); // no timezone, might be the same time + } + + @Test + public void testToHumanDisplayForDateOnlyPrecisions() { + Assertions.assertEquals("2019-01-02", new DateTimeType("2019-01-02").toHumanDisplay()); + Assertions.assertEquals("2019-01", new DateTimeType("2019-01").toHumanDisplay()); + Assertions.assertEquals("2019", new DateTimeType("2019").toHumanDisplay()); + } @Test public void testToHumanDisplayLocalTimezoneForDateOnlyPrecisions() { - assertEquals("2019-01-02", new DateTimeType("2019-01-02").toHumanDisplayLocalTimezone()); - assertEquals("2019-01", new DateTimeType("2019-01").toHumanDisplayLocalTimezone()); - assertEquals("2019", new DateTimeType("2019").toHumanDisplayLocalTimezone()); + Assertions.assertEquals("2019-01-02", new DateTimeType("2019-01-02").toHumanDisplayLocalTimezone()); + Assertions.assertEquals("2019-01", new DateTimeType("2019-01").toHumanDisplayLocalTimezone()); + Assertions.assertEquals("2019", new DateTimeType("2019").toHumanDisplayLocalTimezone()); } - private Boolean compareDateTimes(String theLeft, String theRight) { - System.out.println("Compare "+theLeft+" to "+theRight); - DateTimeType leftDt = new DateTimeType(theLeft); - DateTimeType rightDt = new DateTimeType(theRight); - return leftDt.equalsUsingFhirPathRules(rightDt); - } + private Boolean compareDateTimes(String theLeft, String theRight) { + System.out.println("Compare " + theLeft + " to " + theRight); + DateTimeType leftDt = new DateTimeType(theLeft); + DateTimeType rightDt = new DateTimeType(theRight); + return leftDt.equalsUsingFhirPathRules(rightDt); + } } \ No newline at end of file diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/CDARoundTripTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/CDARoundTripTests.java index f4428ad74..3c71663d7 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/CDARoundTripTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/CDARoundTripTests.java @@ -1,6 +1,5 @@ package org.hl7.fhir.r5.test; -import junit.framework.Assert; import org.hl7.fhir.r5.context.SimpleWorkerContext; import org.hl7.fhir.r5.elementmodel.Element; import org.hl7.fhir.r5.elementmodel.Manager; @@ -10,7 +9,8 @@ import org.hl7.fhir.r5.test.utils.TestingUtilities; import org.hl7.fhir.r5.utils.FHIRPathEngine; import org.hl7.fhir.utilities.cache.PackageCacheManager; import org.hl7.fhir.utilities.cache.ToolsVersion; -import org.junit.Before; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -21,7 +21,7 @@ public class CDARoundTripTests { // private SimpleWorkerContext context; // old-test private FHIRPathEngine fp; - @Before + @BeforeAll public void setUp() throws Exception { // old-test context = new SimpleWorkerContext(); // old-test PackageCacheManager pcm = new PackageCacheManager(true, ToolsVersion.TOOLS_VERSION); @@ -191,8 +191,7 @@ public class CDARoundTripTests { } Element cda = Manager.parse(context, TestingUtilities.loadTestResourceStream("r5", "cda", "example.xml"), FhirFormat.XML); FHIRPathEngine fp = new FHIRPathEngine(context); - Assert.assertEquals("2.16.840.1.113883.3.27.1776", fp.evaluateToString(null, cda, cda, cda, fp.parse("ClinicalDocument.templateId.root"))); - + Assertions.assertEquals("2.16.840.1.113883.3.27.1776", fp.evaluateToString(null, cda, cda, cda, fp.parse("ClinicalDocument.templateId.root"))); } } \ No newline at end of file diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/CanonicalResourceManagerTester.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/CanonicalResourceManagerTester.java index 463693c24..8082cd10b 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/CanonicalResourceManagerTester.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/CanonicalResourceManagerTester.java @@ -3,7 +3,8 @@ package org.hl7.fhir.r5.test; import org.hl7.fhir.r5.context.CanonicalResourceManager; import org.hl7.fhir.r5.context.IWorkerContext.PackageVersion; import org.hl7.fhir.r5.model.ValueSet; -import org.junit.Assert; + +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; public class CanonicalResourceManagerTester { @@ -19,27 +20,27 @@ public class CanonicalResourceManagerTester { mrm.clear(); mrm.see(vs, null); - Assert.assertEquals(mrm.size(), 1); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234")); - Assert.assertNotNull(mrm.get("2345")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertEquals(mrm.size(), 1); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertNotNull(mrm.get("2345")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.0.0")); mrm.see(vs, null); - Assert.assertEquals(mrm.size(), 1); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234")); - Assert.assertNotNull(mrm.get("2345")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertEquals(mrm.size(), 1); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertNotNull(mrm.get("2345")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.0.0")); mrm.drop("2344"); - Assert.assertEquals(mrm.size(), 1); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234")); - Assert.assertNotNull(mrm.get("2345")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertEquals(mrm.size(), 1); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertNotNull(mrm.get("2345")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.0.0")); mrm.drop("2345"); - Assert.assertEquals(mrm.size(), 0); - Assert.assertNull(mrm.get("http://url/ValueSet/234")); - Assert.assertNull(mrm.get("2345")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertEquals(mrm.size(), 0); + Assertions.assertNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertNull(mrm.get("2345")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.0.0")); } @Test @@ -53,13 +54,13 @@ public class CanonicalResourceManagerTester { mrm.clear(); mrm.see(vs, null); - Assert.assertNotNull(mrm.get("2345")); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234")); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); + Assertions.assertNotNull(mrm.get("2345")); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); } @Test @@ -73,11 +74,11 @@ public class CanonicalResourceManagerTester { mrm.clear(); mrm.see(vs, null); - Assert.assertNotNull(mrm.get("2345")); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234")); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "20140403")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "20140402")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "2014")); + Assertions.assertNotNull(mrm.get("2345")); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "20140403")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "20140402")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "2014")); } @Test @@ -98,66 +99,66 @@ public class CanonicalResourceManagerTester { mrm.clear(); mrm.see(vs1, null); - Assert.assertEquals(mrm.size(), 1); - Assert.assertNotNull(mrm.get("2345")); - Assert.assertEquals(mrm.get("2345").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "1"); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); + Assertions.assertEquals(mrm.size(), 1); + Assertions.assertNotNull(mrm.get("2345")); + Assertions.assertEquals(mrm.get("2345").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "1"); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); mrm.see(vs2, null); - Assert.assertEquals(mrm.size(), 2); - Assert.assertNotNull(mrm.get("2345")); - Assert.assertEquals(mrm.get("2345").getName(), "2"); + Assertions.assertEquals(mrm.size(), 2); + Assertions.assertNotNull(mrm.get("2345")); + Assertions.assertEquals(mrm.get("2345").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "2"); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "2"); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); mrm.drop("2346"); // doesn't exist; - Assert.assertEquals(mrm.size(), 2); - Assert.assertNotNull(mrm.get("2345")); - Assert.assertNull(mrm.get("2346")); - Assert.assertEquals(mrm.get("2345").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "2"); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); + Assertions.assertEquals(mrm.size(), 2); + Assertions.assertNotNull(mrm.get("2345")); + Assertions.assertNull(mrm.get("2346")); + Assertions.assertEquals(mrm.get("2345").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "2"); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); mrm.drop("2345"); // vs2; - Assert.assertEquals(mrm.size(), 0); - Assert.assertNull(mrm.get("2345")); - Assert.assertNull(mrm.get("2346")); - Assert.assertNull(mrm.get("http://url/ValueSet/234")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.0.0")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.0.1")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.0.2")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.0")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); + Assertions.assertEquals(mrm.size(), 0); + Assertions.assertNull(mrm.get("2345")); + Assertions.assertNull(mrm.get("2346")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.0.1")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.0.2")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.0")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); } @@ -179,49 +180,49 @@ public class CanonicalResourceManagerTester { mrm.clear(); mrm.see(vs1, null); - Assert.assertEquals(mrm.size(), 1); - Assert.assertNotNull(mrm.get("2345")); - Assert.assertEquals(mrm.get("2345").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "1"); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); + Assertions.assertEquals(mrm.size(), 1); + Assertions.assertNotNull(mrm.get("2345")); + Assertions.assertEquals(mrm.get("2345").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "1"); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); mrm.see(vs2, null); - Assert.assertEquals(mrm.size(), 1); - Assert.assertNotNull(mrm.get("2345")); - Assert.assertEquals(mrm.get("2345").getName(), "2"); + Assertions.assertEquals(mrm.size(), 1); + Assertions.assertNotNull(mrm.get("2345")); + Assertions.assertEquals(mrm.get("2345").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "2"); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "2"); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); mrm.drop("2345"); // vs2; - Assert.assertEquals(mrm.size(), 0); - Assert.assertNull(mrm.get("2345")); - Assert.assertNull(mrm.get("2346")); - Assert.assertNull(mrm.get("http://url/ValueSet/234")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.0.0")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.0.1")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.0.2")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.0")); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); + Assertions.assertEquals(mrm.size(), 0); + Assertions.assertNull(mrm.get("2345")); + Assertions.assertNull(mrm.get("2346")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.0.1")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.0.2")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.0")); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); } @Test @@ -242,57 +243,57 @@ public class CanonicalResourceManagerTester { mrm.clear(); mrm.see(vs1, null); - Assert.assertEquals(mrm.size(), 1); - Assert.assertNotNull(mrm.get("2345")); - Assert.assertEquals(mrm.get("2345").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "1"); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); + Assertions.assertEquals(mrm.size(), 1); + Assertions.assertNotNull(mrm.get("2345")); + Assertions.assertEquals(mrm.get("2345").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "1"); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); mrm.see(vs2, null); - Assert.assertEquals(mrm.size(), 2); - Assert.assertNotNull(mrm.get("2345")); - Assert.assertEquals(mrm.get("2345").getName(), "1"); - Assert.assertNotNull(mrm.get("2346")); - Assert.assertEquals(mrm.get("2346").getName(), "2"); + Assertions.assertEquals(mrm.size(), 2); + Assertions.assertNotNull(mrm.get("2345")); + Assertions.assertEquals(mrm.get("2345").getName(), "1"); + Assertions.assertNotNull(mrm.get("2346")); + Assertions.assertEquals(mrm.get("2346").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "2"); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "2"); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); mrm.drop("2346"); // vs2; - Assert.assertEquals(mrm.size(), 1); - Assert.assertNotNull(mrm.get("2345")); - Assert.assertNull(mrm.get("2346")); - Assert.assertEquals(mrm.get("2345").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "1"); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); + Assertions.assertEquals(mrm.size(), 1); + Assertions.assertNotNull(mrm.get("2345")); + Assertions.assertNull(mrm.get("2346")); + Assertions.assertEquals(mrm.get("2345").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "1"); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); } @@ -314,58 +315,58 @@ public class CanonicalResourceManagerTester { mrm.clear(); mrm.see(vs1, null); - Assert.assertEquals(mrm.size(), 1); - Assert.assertNotNull(mrm.get("2345")); - Assert.assertEquals(mrm.get("2345").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "1"); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); + Assertions.assertEquals(mrm.size(), 1); + Assertions.assertNotNull(mrm.get("2345")); + Assertions.assertEquals(mrm.get("2345").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "1"); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); mrm.see(vs2, null); - Assert.assertEquals(mrm.size(), 2); - Assert.assertNotNull(mrm.get("2345")); - Assert.assertEquals(mrm.get("2345").getName(), "1"); - Assert.assertNotNull(mrm.get("2346")); - Assert.assertEquals(mrm.get("2346").getName(), "2"); + Assertions.assertEquals(mrm.size(), 2); + Assertions.assertNotNull(mrm.get("2345")); + Assertions.assertEquals(mrm.get("2345").getName(), "1"); + Assertions.assertNotNull(mrm.get("2346")); + Assertions.assertEquals(mrm.get("2346").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "2"); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "1"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "2"); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); mrm.drop("2345"); // vs1; - Assert.assertEquals(mrm.size(), 1); - Assert.assertNull(mrm.get("2345")); - Assert.assertNotNull(mrm.get("2346")); - Assert.assertEquals(mrm.get("2346").getName(), "2"); + Assertions.assertEquals(mrm.size(), 1); + Assertions.assertNull(mrm.get("2345")); + Assertions.assertNotNull(mrm.get("2346")); + Assertions.assertEquals(mrm.get("2346").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "2"); - Assert.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); - Assert.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "2"); - Assert.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.0").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.1")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.1").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0.2")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0.2").getName(), "2"); + Assertions.assertNotNull(mrm.get("http://url/ValueSet/234", "4.0")); + Assertions.assertEquals(mrm.get("http://url/ValueSet/234", "4.0").getName(), "2"); + Assertions.assertNull(mrm.get("http://url/ValueSet/234", "4.1")); } @Test @@ -385,15 +386,15 @@ public class CanonicalResourceManagerTester { mrm.see(vs1, null); - Assert.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234")); - Assert.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234", "2.0.0")); - Assert.assertTrue(mrm.get("http://terminology.hl7.org/ValueSet/234").getName().equals("1")); + Assertions.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234")); + Assertions.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234", "2.0.0")); + Assertions.assertTrue(mrm.get("http://terminology.hl7.org/ValueSet/234").getName().equals("1")); mrm.see(vs2, null); - Assert.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234")); - Assert.assertTrue(mrm.get("http://terminology.hl7.org/ValueSet/234").getName().equals("2")); - Assert.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234", "2.0.0")); - Assert.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234", "2000.0.0")); + Assertions.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234")); + Assertions.assertTrue(mrm.get("http://terminology.hl7.org/ValueSet/234").getName().equals("2")); + Assertions.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234", "2.0.0")); + Assertions.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234", "2000.0.0")); } @Test @@ -413,13 +414,13 @@ public class CanonicalResourceManagerTester { mrm.see(vs1, new PackageVersion("hl7.fhir.r4.core", "4.0.1")); - Assert.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234")); - Assert.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234", "2.0.0")); - Assert.assertTrue(mrm.get("http://terminology.hl7.org/ValueSet/234").getName().equals("1")); + Assertions.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234")); + Assertions.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234", "2.0.0")); + Assertions.assertTrue(mrm.get("http://terminology.hl7.org/ValueSet/234").getName().equals("1")); mrm.see(vs2, new PackageVersion("hl7.terminology.r4", "4.0.1")); - Assert.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234")); - Assert.assertTrue(mrm.get("http://terminology.hl7.org/ValueSet/234").getName().equals("2")); - Assert.assertNull(mrm.get("http://terminology.hl7.org/ValueSet/234", "2.0.0")); // this will get dropped completely because of UTG rules + Assertions.assertNotNull(mrm.get("http://terminology.hl7.org/ValueSet/234")); + Assertions.assertTrue(mrm.get("http://terminology.hl7.org/ValueSet/234").getName().equals("2")); + Assertions.assertNull(mrm.get("http://terminology.hl7.org/ValueSet/234", "2.0.0")); // this will get dropped completely because of UTG rules } } diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/FHIRMappingLanguageTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/FHIRMappingLanguageTests.java index 4f5a3ae53..eae810b2f 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/FHIRMappingLanguageTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/FHIRMappingLanguageTests.java @@ -37,7 +37,6 @@ import java.util.stream.Stream; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class FHIRMappingLanguageTests implements ITransformerServices { private List outputs = new ArrayList(); @@ -45,7 +44,6 @@ public class FHIRMappingLanguageTests implements ITransformerServices { static private SimpleWorkerContext context; static private JsonParser jsonParser; - @Parameters public static Stream data() throws FileNotFoundException, IOException, ParserConfigurationException, SAXException { Document tests = XMLUtil.parseToDom(TestingUtilities.loadTestResource("r5", "fml", "manifest.xml")); @@ -60,7 +58,7 @@ public class FHIRMappingLanguageTests implements ITransformerServices { } @BeforeAll - public void setUp() throws Exception { + public static void setUp() throws Exception { PackageCacheManager pcm = new PackageCacheManager(true, ToolsVersion.TOOLS_VERSION); context = SimpleWorkerContext.fromPackage(pcm.loadPackage("hl7.fhir.core", "4.0.1")); jsonParser = new JsonParser(); diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/FHIRPathTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/FHIRPathTests.java index bcff08eb4..b8bf988a3 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/FHIRPathTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/FHIRPathTests.java @@ -1,6 +1,5 @@ package org.hl7.fhir.r5.test; -import junit.framework.Assert; import org.apache.commons.lang3.NotImplementedException; import org.fhir.ucum.UcumException; import org.hl7.fhir.exceptions.FHIRException; @@ -12,6 +11,7 @@ import org.hl7.fhir.r5.utils.FHIRPathEngine; import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.xml.XMLUtil; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; @@ -156,9 +156,9 @@ public class FHIRPathTests { fp.check(res, res.getResourceType().toString(), res.getResourceType().toString(), node); } outcome = fp.evaluate(res, node); - Assert.assertTrue(String.format("Expected exception parsing %s", expression), !fail); + Assertions.assertFalse(fail, String.format("Expected exception parsing %s", expression)); } catch (Exception e) { - Assert.assertTrue(String.format("Unexpected exception parsing %s: " + e.getMessage(), expression), fail); + Assertions.assertTrue(fail, String.format("Unexpected exception parsing %s: " + e.getMessage(), expression)); } if ("true".equals(test.getAttribute("predicate"))) { @@ -171,7 +171,7 @@ public class FHIRPathTests { List expected = new ArrayList(); XMLUtil.getNamedChildren(test, "output", expected); - Assert.assertTrue(String.format("Expected %d objects but found %d for expression %s", expected.size(), outcome.size(), expression), outcome.size() == expected.size()); + Assertions.assertEquals(outcome.size(), expected.size(), String.format("Expected %d objects but found %d for expression %s", expected.size(), outcome.size(), expression)); if ("false".equals(test.getAttribute("ordered"))) { for (int i = 0; i < Math.min(outcome.size(), expected.size()); i++) { String tn = outcome.get(i).fhirType(); @@ -186,22 +186,22 @@ public class FHIRPathTests { (Utilities.noString(e.getTextContent()) || e.getTextContent().equals(s))) found = true; } - Assert.assertTrue(String.format("Outcome %d: Value %s of type %s not expected for %s", i, s, tn, expression), found); + Assertions.assertTrue(found, String.format("Outcome %d: Value %s of type %s not expected for %s", i, s, tn, expression)); } } else { for (int i = 0; i < Math.min(outcome.size(), expected.size()); i++) { String tn = expected.get(i).getAttribute("type"); if (!Utilities.noString(tn)) { - Assert.assertTrue(String.format("Outcome %d: Type should be %s but was %s", i, tn, outcome.get(i).fhirType()), tn.equals(outcome.get(i).fhirType())); + Assertions.assertEquals(tn, outcome.get(i).fhirType(), String.format("Outcome %d: Type should be %s but was %s", i, tn, outcome.get(i).fhirType())); } String v = expected.get(i).getTextContent(); if (!Utilities.noString(v)) { if (outcome.get(i) instanceof Quantity) { Quantity q = fp.parseQuantityString(v); - Assert.assertTrue(String.format("Outcome %d: Value should be %s but was %s", i, v, outcome.get(i).toString()), outcome.get(i).equalsDeep(q)); + Assertions.assertTrue(outcome.get(i).equalsDeep(q), String.format("Outcome %d: Value should be %s but was %s", i, v, outcome.get(i).toString())); } else { - Assert.assertTrue(String.format("Outcome %d: Value should be a primitive type but was %s", i, outcome.get(i).fhirType()), outcome.get(i) instanceof PrimitiveType); - Assert.assertTrue(String.format("Outcome %d: Value should be %s but was %s for expression %s", i, v, outcome.get(i).toString(), expression), v.equals(((PrimitiveType) outcome.get(i)).asStringValue())); + Assertions.assertTrue(outcome.get(i) instanceof PrimitiveType, String.format("Outcome %d: Value should be a primitive type but was %s", i, outcome.get(i).fhirType())); + Assertions.assertEquals(v, ((PrimitiveType) outcome.get(i)).asStringValue(), String.format("Outcome %d: Value should be %s but was %s for expression %s", i, v, outcome.get(i).toString(), expression)); } } } diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/GraphQLEngineTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/GraphQLEngineTests.java index 306231505..36aac9e05 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/GraphQLEngineTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/GraphQLEngineTests.java @@ -20,21 +20,15 @@ import org.hl7.fhir.utilities.graphql.IGraphQLStorageServices; import org.hl7.fhir.utilities.graphql.NameValue; import org.hl7.fhir.utilities.graphql.Parser; import org.hl7.fhir.utilities.xml.XMLUtil; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.SAXException; import javax.xml.parsers.ParserConfigurationException; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -42,8 +36,6 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; -import static org.junit.Assert.assertTrue; - public class GraphQLEngineTests implements IGraphQLStorageServices { public static Stream data() throws IOException, ParserConfigurationException, SAXException { @@ -91,7 +83,7 @@ public class GraphQLEngineTests implements IGraphQLStorageServices { msg = e.getMessage(); } if (ok) { - assertTrue("Expected to fail, but didn't", !output.equals("$error")); + Assertions.assertTrue(!output.equals("$error"), "Expected to fail, but didn't"); StringBuilder str = new StringBuilder(); gql.getOutput().setWriteWrapper(false); gql.getOutput().write(str, 0); @@ -99,10 +91,10 @@ public class GraphQLEngineTests implements IGraphQLStorageServices { IOUtils.copy(TestingUtilities.loadTestResourceStream("r5", "graphql", output), new FileOutputStream(TestingUtilities.tempFile("graphql", output))); TextFile.stringToFile(str.toString(), TestingUtilities.tempFile("graphql", output+".out")); msg = TestingUtilities.checkJsonIsSame(TestingUtilities.tempFile("graphql", output+".out"), TestingUtilities.tempFile("graphql", output)); - assertTrue(msg, Utilities.noString(msg)); + Assertions.assertTrue(Utilities.noString(msg), msg); } else - assertTrue("Error, but proper output was expected ("+msg+")", output.equals("$error")); + Assertions.assertTrue(output.equals("$error"), "Error, but proper output was expected ("+msg+")"); } @Override diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/GraphQLParserTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/GraphQLParserTests.java index 32210e336..6ef885c19 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/GraphQLParserTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/GraphQLParserTests.java @@ -1,48 +1,41 @@ package org.hl7.fhir.r5.test; -import static org.junit.Assert.assertTrue; - -import java.io.FileNotFoundException; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Stream; - import org.hl7.fhir.r5.test.utils.TestingUtilities; -import org.hl7.fhir.utilities.TextFile; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.graphql.EGraphEngine; import org.hl7.fhir.utilities.graphql.EGraphQLException; import org.hl7.fhir.utilities.graphql.Package; import org.hl7.fhir.utilities.graphql.Parser; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Stream; public class GraphQLParserTests { - public static Stream data() throws FileNotFoundException, IOException { + public static Stream data() throws IOException { String src = TestingUtilities.loadTestResource("r5", "graphql", "parser-tests.gql"); String[] tests = src.split("###"); List objects = new ArrayList<>(); for (String s : tests) { if (!Utilities.noString(s.trim())) { - int l = s.indexOf('\r'); - objects.add(Arguments.of(s.substring(0, l), s.substring(l+2).trim())); + int l = s.indexOf('\r'); + objects.add(Arguments.of(s.substring(0, l), s.substring(l + 2).trim())); } } return objects.stream(); } - @ParameterizedTest(name = "{index}: {0}") + @ParameterizedTest(name = "{index}: {0}") @MethodSource("data") public void test(String name, String test) throws IOException, EGraphQLException, EGraphEngine { Package doc = Parser.parse(test); - assertTrue(doc != null); + Assertions.assertNotNull(doc); } diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/LiquidEngineTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/LiquidEngineTests.java index 4d2168b22..c0d77cb3d 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/LiquidEngineTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/LiquidEngineTests.java @@ -3,7 +3,6 @@ package org.hl7.fhir.r5.test; import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; -import junit.framework.Assert; import org.apache.commons.collections4.map.HashedMap; import org.hl7.fhir.exceptions.FHIRFormatError; import org.hl7.fhir.r5.formats.XmlParser; @@ -12,11 +11,11 @@ import org.hl7.fhir.r5.test.utils.TestingUtilities; import org.hl7.fhir.r5.utils.LiquidEngine; import org.hl7.fhir.r5.utils.LiquidEngine.ILiquidEngineIcludeResolver; import org.hl7.fhir.r5.utils.LiquidEngine.LiquidDocument; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; import org.xml.sax.SAXException; import javax.xml.parsers.ParserConfigurationException; @@ -24,40 +23,41 @@ import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.stream.Stream; -@RunWith(Parameterized.class) public class LiquidEngineTests implements ILiquidEngineIcludeResolver { - //TODO Migrate this test to JUnit Jupiter. Need to refactor the base class ILiquidEngineIcludeResolver to do this properly. - private static Map resources = new HashedMap<>(); private static JsonObject testdoc = null; private JsonObject test; private LiquidEngine engine; - @Parameters(name = "{index}: file{0}") - public static Iterable data() throws ParserConfigurationException, SAXException, IOException { - testdoc = (JsonObject) new com.google.gson.JsonParser().parse(TestingUtilities.loadTestResource("r5", "liquid", "liquid-tests.json")); - JsonArray tests = testdoc.getAsJsonArray("tests"); - List objects = new ArrayList(tests.size()); - for (JsonElement n : tests) { - objects.add(new Object[]{n}); - } - return objects; - } - - public LiquidEngineTests(JsonObject test) { - super(); - this.test = test; - } - - @Before + @BeforeEach public void setUp() throws Exception { engine = new LiquidEngine(TestingUtilities.context(), null); engine.setIncludeResolver(this); } + public static Stream data() throws ParserConfigurationException, SAXException, IOException { + testdoc = (JsonObject) new com.google.gson.JsonParser().parse(TestingUtilities.loadTestResource("r5", "liquid", "liquid-tests.json")); + JsonArray tests = testdoc.getAsJsonArray("tests"); + List objects = new ArrayList<>(); + for (JsonElement n : tests) { + objects.add(Arguments.of(n)); + } + return objects.stream(); + } + + @ParameterizedTest(name = "{index}: file{0}") + @MethodSource("data") + public void test(JsonObject test) throws Exception { + this.test = test; + LiquidDocument doc = engine.parse(test.get("template").getAsString(), "test-script"); + String output = engine.evaluate(doc, loadResource(), null); + Assertions.assertTrue(test.get("output").getAsString().equals(output)); + } + @Override public String fetchInclude(LiquidEngine engine, String name) { if (test.has("includes") && test.getAsJsonObject("includes").has(name)) @@ -74,11 +74,4 @@ public class LiquidEngineTests implements ILiquidEngineIcludeResolver { return resources.get(test.get("focus").getAsString()); } - @Test - public void test() throws Exception { - LiquidDocument doc = engine.parse(test.get("template").getAsString(), "test-script"); - String output = engine.evaluate(doc, loadResource(), null); - Assert.assertTrue(test.get("output").getAsString().equals(output)); - } - } diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/MetaTest.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/MetaTest.java index 0858cc444..97f0de7b7 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/MetaTest.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/MetaTest.java @@ -2,11 +2,9 @@ package org.hl7.fhir.r5.test; import org.hl7.fhir.r5.model.Coding; import org.hl7.fhir.r5.model.Meta; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import static org.junit.Assert.*; -import static org.junit.Assert.assertEquals; - public class MetaTest { public static String TEST_SYSTEM = "TEST_SYSTEM"; public static String TEST_CODE = "TEST_CODE"; @@ -15,12 +13,12 @@ public class MetaTest { public void testMetaSecurity() { Meta meta = new Meta(); Coding coding = meta.addSecurity().setSystem(TEST_SYSTEM).setCode(TEST_CODE); - assertTrue(meta.hasSecurity()); - assertNotNull(meta.getSecurity()); - assertNotNull(meta.getSecurity(TEST_SYSTEM, TEST_CODE)); - assertEquals(1, meta.getSecurity().size()); - assertEquals(meta.getSecurity().get(0), meta.getSecurity(TEST_SYSTEM, TEST_CODE)); - assertEquals(meta.getSecurityFirstRep(), meta.getSecurity(TEST_SYSTEM, TEST_CODE)); - assertEquals(coding, meta.getSecurity(TEST_SYSTEM, TEST_CODE)); + Assertions.assertTrue(meta.hasSecurity()); + Assertions.assertNotNull(meta.getSecurity()); + Assertions.assertNotNull(meta.getSecurity(TEST_SYSTEM, TEST_CODE)); + Assertions.assertEquals(1, meta.getSecurity().size()); + Assertions.assertEquals(meta.getSecurity().get(0), meta.getSecurity(TEST_SYSTEM, TEST_CODE)); + Assertions.assertEquals(meta.getSecurityFirstRep(), meta.getSecurity(TEST_SYSTEM, TEST_CODE)); + Assertions.assertEquals(coding, meta.getSecurity(TEST_SYSTEM, TEST_CODE)); } } diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/NarrativeGenerationTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/NarrativeGenerationTests.java index dd294e066..139637195 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/NarrativeGenerationTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/NarrativeGenerationTests.java @@ -12,7 +12,6 @@ import org.hl7.fhir.utilities.xml.XMLUtil; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; @@ -28,11 +27,10 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; -@TestInstance(TestInstance.Lifecycle.PER_CLASS) -@Disabled //Test case 1 doesn't pass in r5 yet +@Disabled //Test case 1 doesn't pass public class NarrativeGenerationTests { - private IWorkerContext context; + private static IWorkerContext context; public static class TestDetails { private String id; @@ -60,8 +58,8 @@ public class NarrativeGenerationTests { } @BeforeAll - public void setUp() { - this.context = TestingUtilities.context(); + public static void setUp() { + context = TestingUtilities.context(); } @ParameterizedTest(name = "{index}: file {0}") diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/NarrativeGeneratorTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/NarrativeGeneratorTests.java index 7132abc49..f56cafab1 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/NarrativeGeneratorTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/NarrativeGeneratorTests.java @@ -1,6 +1,5 @@ package org.hl7.fhir.r5.test; -import org.fhir.ucum.UcumException; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r5.formats.XmlParser; import org.hl7.fhir.r5.model.DomainResource; @@ -9,7 +8,6 @@ import org.hl7.fhir.r5.utils.EOperationOutcome; import org.hl7.fhir.r5.utils.NarrativeGenerator; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.TestInstance; import org.xmlpull.v1.XmlPullParserException; import java.io.FileNotFoundException; @@ -17,13 +15,12 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -@TestInstance(TestInstance.Lifecycle.PER_CLASS) public class NarrativeGeneratorTests { - private NarrativeGenerator gen; + private static NarrativeGenerator gen; @BeforeAll - public void setUp() throws FileNotFoundException, IOException, FHIRException, UcumException { + public static void setUp() throws FHIRException { gen = new NarrativeGenerator("", null, TestingUtilities.context()); } diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/NpmPackageTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/NpmPackageTests.java index 13e23ae59..d5bdd4f96 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/NpmPackageTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/NpmPackageTests.java @@ -6,7 +6,12 @@ import org.hl7.fhir.utilities.cache.NpmPackage; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import java.io.*; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/PackageCacheTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/PackageCacheTests.java index b7a62899e..51261060c 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/PackageCacheTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/PackageCacheTests.java @@ -1,8 +1,5 @@ package org.hl7.fhir.r5.test; -import java.io.File; -import java.io.IOException; - import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.cache.NpmPackage; import org.hl7.fhir.utilities.cache.PackageCacheManager; @@ -11,6 +8,9 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import java.io.File; +import java.io.IOException; + public class PackageCacheTests { @Test @@ -29,7 +29,7 @@ public class PackageCacheTests { Utilities.createDirectory(dir.getAbsolutePath()); } npm.save(dir); - NpmPackage npm2 = cache.loadPackage("hl7.fhir.pubpack", "file:"+dir.getAbsolutePath()); + NpmPackage npm2 = cache.loadPackage("hl7.fhir.pubpack", "file:" + dir.getAbsolutePath()); Assertions.assertNotNull(npm2); } } diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/PackageClientTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/PackageClientTests.java index 50f20f69b..b462e1a0c 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/PackageClientTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/PackageClientTests.java @@ -52,7 +52,6 @@ public class PackageClientTests { Assertions.assertTrue(matches.size() == 0); } - @Test public void testExists2() throws IOException { PackageClient client = new PackageClient("http://test.fhir.org/packages"); diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ProfileUtilitiesTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ProfileUtilitiesTests.java index d8406e878..e3fb90121 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ProfileUtilitiesTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ProfileUtilitiesTests.java @@ -1,11 +1,5 @@ package org.hl7.fhir.r5.test; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - import org.fhir.ucum.UcumException; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r5.conformance.ProfileUtilities; @@ -22,9 +16,15 @@ import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.junit.jupiter.api.Test; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + public class ProfileUtilitiesTests { -// /** + // /** // * This is simple: we just create an empty differential, generate the snapshot, and then insist it must match the base // * // * @param context2 @@ -48,9 +48,9 @@ public class ProfileUtilitiesTests { ElementDefinition b = base.getSnapshot().getElement().get(i); ElementDefinition f = focus.getSnapshot().getElement().get(i); if (ok) { - if (!f.hasBase()) + if (!f.hasBase()) ok = false; - else if (!b.getPath().equals(f.getPath())) + else if (!b.getPath().equals(f.getPath())) ok = false; else { b.setBase(null); @@ -65,12 +65,12 @@ public class ProfileUtilitiesTests { if (!ok) { compareXml(base, focus); throw new FHIRException("Snap shot generation simple test failed"); - } else + } else System.out.println("Snap shot generation simple test passed"); } - -// + + // // /** // * This is simple: we just create an empty differential, generate the snapshot, and then insist it must match the base. for a different resource with recursion // * @@ -86,14 +86,14 @@ public class ProfileUtilitiesTests { focus.setSnapshot(null); focus.setDifferential(null); List messages = new ArrayList(); - new ProfileUtilities(TestingUtilities.context(), messages, null).generateSnapshot(base, focus, focus.getUrl(), "http://test.org", "Simple Test" ); + new ProfileUtilities(TestingUtilities.context(), messages, null).generateSnapshot(base, focus, focus.getUrl(), "http://test.org", "Simple Test"); boolean ok = base.getSnapshot().getElement().size() == focus.getSnapshot().getElement().size(); for (int i = 0; i < base.getSnapshot().getElement().size(); i++) { if (ok) { ElementDefinition b = base.getSnapshot().getElement().get(i); ElementDefinition f = focus.getSnapshot().getElement().get(i); - if (!f.hasBase() || !b.getPath().equals(f.getPath())) + if (!f.hasBase() || !b.getPath().equals(f.getPath())) ok = false; else { f.setBase(null); @@ -108,12 +108,12 @@ public class ProfileUtilitiesTests { } } } - + if (!ok) { compareXml(base, focus); System.out.println("Snap shot generation simple test failed"); throw new FHIRException("Snap shot generation simple test failed"); - } else + } else System.out.println("Snap shot generation simple test passed"); } @@ -799,8 +799,10 @@ public class ProfileUtilitiesTests { // focus.setDifferential(null); String f1 = Utilities.path("c:", "temp", "base.xml"); String f2 = Utilities.path("c:", "temp", "derived.xml"); - new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(f1), base);; - new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(f2), focus);; + new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(f1), base); + ; + new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(f2), focus); + ; String diff = Utilities.path(System.getenv("ProgramFiles(X86)"), "WinMerge", "WinMergeU.exe"); List command = new ArrayList(); command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\""); diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ResourceRoundTripTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ResourceRoundTripTests.java index 00085fbd5..d163a22c8 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ResourceRoundTripTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ResourceRoundTripTests.java @@ -1,7 +1,6 @@ package org.hl7.fhir.r5.test; import org.apache.commons.io.IOUtils; -import org.fhir.ucum.UcumException; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r5.formats.IParser; import org.hl7.fhir.r5.formats.IParser.OutputStyle; @@ -15,12 +14,16 @@ import org.hl7.fhir.r5.utils.EOperationOutcome; import org.hl7.fhir.r5.utils.NarrativeGenerator; import org.junit.jupiter.api.Test; -import java.io.*; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; public class ResourceRoundTripTests { @Test - public void test() throws FileNotFoundException, IOException, FHIRException, EOperationOutcome, UcumException { + public void test() throws IOException, FHIRException, EOperationOutcome { Resource res = new XmlParser().parse(TestingUtilities.loadTestResourceStream("r5", "unicode.xml")); new NarrativeGenerator("", "", TestingUtilities.context()).generate((DomainResource) res, null); IOUtils.copy(TestingUtilities.loadTestResourceStream("r5", "unicode.xml"), new FileOutputStream(TestingUtilities.tempFile("gen", "unicode.xml"))); diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ShexGeneratorTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ShexGeneratorTests.java index 1a19e813e..83c6c19eb 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ShexGeneratorTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ShexGeneratorTests.java @@ -1,10 +1,5 @@ package org.hl7.fhir.r5.test; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.nio.file.FileSystems; -import java.nio.file.Path; - import org.fhir.ucum.UcumException; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r5.conformance.ProfileUtilities; @@ -15,14 +10,19 @@ import org.hl7.fhir.r5.test.utils.TestingUtilities; import org.hl7.fhir.utilities.TextFile; import org.junit.jupiter.api.Test; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.file.FileSystems; +import java.nio.file.Path; + public class ShexGeneratorTests { private void doTest(String name) throws FileNotFoundException, IOException, FHIRException, UcumException { StructureDefinition sd = TestingUtilities.context().fetchResource(StructureDefinition.class, ProfileUtilities.sdNs(name, null)); - if(sd == null) { + if (sd == null) { throw new FHIRException("StructuredDefinition for " + name + "was null"); } - Path outPath = FileSystems.getDefault().getPath(System.getProperty("java.io.tmpdir"), name.toLowerCase()+".shex"); + Path outPath = FileSystems.getDefault().getPath(System.getProperty("java.io.tmpdir"), name.toLowerCase() + ".shex"); TextFile.stringToFile(new ShExGenerator(TestingUtilities.context()).generate(HTMLLinkPolicy.NONE, sd), outPath.toString()); } @@ -36,7 +36,6 @@ public class ShexGeneratorTests { doTest("uri"); } - @Test public void testObservation() throws FHIRException, IOException, UcumException { doTest("Observation"); diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/SnapShotGenerationTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/SnapShotGenerationTests.java index 5439177b5..45c79824c 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/SnapShotGenerationTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/SnapShotGenerationTests.java @@ -12,11 +12,16 @@ import org.hl7.fhir.r5.context.IWorkerContext.IContextResourceLoader; import org.hl7.fhir.r5.formats.IParser.OutputStyle; import org.hl7.fhir.r5.formats.JsonParser; import org.hl7.fhir.r5.formats.XmlParser; -import org.hl7.fhir.r5.model.*; +import org.hl7.fhir.r5.model.Base; +import org.hl7.fhir.r5.model.Bundle; import org.hl7.fhir.r5.model.ElementDefinition.ElementDefinitionBindingComponent; import org.hl7.fhir.r5.model.ExpressionNode.CollectionStatus; +import org.hl7.fhir.r5.model.Resource; +import org.hl7.fhir.r5.model.StructureDefinition; import org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind; import org.hl7.fhir.r5.model.StructureDefinition.TypeDerivationRule; +import org.hl7.fhir.r5.model.TypeDetails; +import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.test.utils.TestingUtilities; import org.hl7.fhir.r5.utils.FHIRPathEngine; import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext; @@ -40,7 +45,11 @@ import org.w3c.dom.Element; import org.xml.sax.SAXException; import javax.xml.parsers.ParserConfigurationException; -import java.io.*; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/SnomedExpressionsTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/SnomedExpressionsTests.java index 08f6cfc8b..ebe7ac0d5 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/SnomedExpressionsTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/SnomedExpressionsTests.java @@ -2,10 +2,9 @@ package org.hl7.fhir.r5.test; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r5.utils.SnomedExpressions; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import static org.junit.Assert.assertNotNull; - public class SnomedExpressionsTests { @Test @@ -47,8 +46,6 @@ public class SnomedExpressionsTests { } private void p(String expression) throws FHIRException { - assertNotNull("must be present", SnomedExpressions.parse(expression)); - + Assertions.assertNotNull(SnomedExpressions.parse(expression), "must be present"); } - } diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/StructureMapUtilitiesTest.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/StructureMapUtilitiesTest.java index c211f979e..a3de33601 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/StructureMapUtilitiesTest.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/StructureMapUtilitiesTest.java @@ -10,7 +10,6 @@ import org.hl7.fhir.r5.utils.StructureMapUtilities; import org.hl7.fhir.r5.utils.StructureMapUtilities.ITransformerServices; import org.hl7.fhir.utilities.cache.PackageCacheManager; import org.hl7.fhir.utilities.cache.ToolsVersion; -import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; @@ -24,7 +23,7 @@ public class StructureMapUtilitiesTest implements ITransformerServices { static private SimpleWorkerContext context; - @BeforeAll + // @BeforeAll static public void setUp() throws Exception { PackageCacheManager pcm = new PackageCacheManager(true, ToolsVersion.TOOLS_VERSION); context = SimpleWorkerContext.fromPackage(pcm.loadPackage("hl7.fhir.core", "4.0.0")); diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/TurtleTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/TurtleTests.java index 4355ffbb1..7c5aab4c4 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/TurtleTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/TurtleTests.java @@ -1,23 +1,22 @@ package org.hl7.fhir.r5.test; -import java.io.FileNotFoundException; -import java.io.IOException; - import org.hl7.fhir.r5.test.utils.TestingUtilities; import org.hl7.fhir.r5.utils.formats.Turtle; - -import junit.framework.Assert; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; +import java.io.FileNotFoundException; +import java.io.IOException; + public class TurtleTests { private void doTest(String s, boolean ok) throws Exception { try { Turtle ttl = new Turtle(); ttl.parse(s); - Assert.assertTrue(ok); + Assertions.assertTrue(ok); } catch (Exception e) { - Assert.assertTrue(e.getMessage(), !ok); + Assertions.assertFalse(ok, e.getMessage()); } } @@ -25,23 +24,28 @@ public class TurtleTests { public void test_double_lower_case_e1() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "double_lower_case_e.nt"), true); } + @Test public void test_double_lower_case_e2() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "double_lower_case_e.ttl"), true); } + @Test public void test_empty_collection1() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "empty_collection.nt"), true); } + @Test public void test_empty_collection2() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "empty_collection.ttl"), true); } + @Test public void test_first1() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "first.nt"), true); } -// @Test + + // @Test // public void test_first2() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "first.ttl"), true); // } @@ -49,243 +53,303 @@ public class TurtleTests { public void test_HYPHEN_MINUS_in_localNameNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "HYPHEN_MINUS_in_localName.nt"), true); } + @Test public void test_HYPHEN_MINUS_in_localName() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "HYPHEN_MINUS_in_localName.ttl"), true); } + @Test public void test_IRI_spoNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "IRI_spo.nt"), true); } + @Test public void test_IRI_subject() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "IRI_subject.ttl"), true); } + @Test public void test_IRI_with_all_punctuationNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "IRI_with_all_punctuation.nt"), true); } + @Test public void test_IRI_with_all_punctuation() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "IRI_with_all_punctuation.ttl"), true); } + @Test public void test_IRI_with_eight_digit_numeric_escape() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "IRI_with_eight_digit_numeric_escape.ttl"), true); } + @Test public void test_IRI_with_four_digit_numeric_escape() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "IRI_with_four_digit_numeric_escape.ttl"), true); } + @Test public void test_IRIREF_datatypeNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "IRIREF_datatype.nt"), true); } + @Test public void test_IRIREF_datatype() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "IRIREF_datatype.ttl"), true); } + @Test public void test_labeled_blank_node_objectNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "labeled_blank_node_object.nt"), true); } + @Test public void test_labeled_blank_node_object() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "labeled_blank_node_object.ttl"), true); } + @Test public void test_labeled_blank_node_subjectNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "labeled_blank_node_subject.nt"), true); } + @Test public void test_labeled_blank_node_subject() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "labeled_blank_node_subject.ttl"), true); } + @Test public void test_labeled_blank_node_with_leading_digit() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "labeled_blank_node_with_leading_digit.ttl"), true); } + @Test public void test_labeled_blank_node_with_leading_underscore() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "labeled_blank_node_with_leading_underscore.ttl"), true); } + @Test public void test_labeled_blank_node_with_non_leading_extras() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "labeled_blank_node_with_non_leading_extras.ttl"), true); } + @Test public void test_labeled_blank_node_with_PN_CHARS_BASE_character_boundaries() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "labeled_blank_node_with_PN_CHARS_BASE_character_boundaries.ttl"), false); } + @Test public void test_langtagged_LONG() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "langtagged_LONG.ttl"), true); } + @Test public void test_langtagged_LONG_with_subtagNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "langtagged_LONG_with_subtag.nt"), true); } + @Test public void test_langtagged_LONG_with_subtag() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "langtagged_LONG_with_subtag.ttl"), true); } + @Test public void test_langtagged_non_LONGNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "langtagged_non_LONG.nt"), true); } + @Test public void test_langtagged_non_LONG() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "langtagged_non_LONG.ttl"), true); } + @Test public void test_lantag_with_subtagNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "lantag_with_subtag.nt"), true); } + @Test public void test_lantag_with_subtag() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "lantag_with_subtag.ttl"), true); } + @Test public void test_lastNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "last.nt"), true); } + @Test public void test_last() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "last.ttl"), false); } + @Test public void test_literal_falseNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_false.nt"), true); } + @Test public void test_literal_false() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_false.ttl"), true); } + @Test public void test_LITERAL_LONG1() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG1.ttl"), true); } + @Test public void test_LITERAL_LONG1_ascii_boundariesNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG1_ascii_boundaries.nt"), false); } + @Test public void test_LITERAL_LONG1_ascii_boundaries() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG1_ascii_boundaries.ttl"), true); } + @Test public void test_LITERAL_LONG1_with_1_squoteNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG1_with_1_squote.nt"), true); } + @Test public void test_LITERAL_LONG1_with_1_squote() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG1_with_1_squote.ttl"), true); } + @Test public void test_LITERAL_LONG1_with_2_squotesNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG1_with_2_squotes.nt"), true); } + @Test public void test_LITERAL_LONG1_with_2_squotes() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG1_with_2_squotes.ttl"), true); } + @Test public void test_LITERAL_LONG1_with_UTF8_boundaries() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG1_with_UTF8_boundaries.ttl"), true); } + @Test public void test_LITERAL_LONG2() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG2.ttl"), true); } + @Test public void test_LITERAL_LONG2_ascii_boundariesNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG2_ascii_boundaries.nt"), false); } + @Test public void test_LITERAL_LONG2_ascii_boundaries() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG2_ascii_boundaries.ttl"), true); } + @Test public void test_LITERAL_LONG2_with_1_squoteNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG2_with_1_squote.nt"), true); } + @Test public void test_LITERAL_LONG2_with_1_squote() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG2_with_1_squote.ttl"), true); } + @Test public void test_LITERAL_LONG2_with_2_squotesNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG2_with_2_squotes.nt"), true); } + @Test public void test_LITERAL_LONG2_with_2_squotes() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG2_with_2_squotes.ttl"), true); } + @Test public void test_LITERAL_LONG2_with_REVERSE_SOLIDUSNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG2_with_REVERSE_SOLIDUS.nt"), false); } + @Test public void test_LITERAL_LONG2_with_REVERSE_SOLIDUS() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG2_with_REVERSE_SOLIDUS.ttl"), false); } + @Test public void test_LITERAL_LONG2_with_UTF8_boundaries() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_LONG2_with_UTF8_boundaries.ttl"), true); } + @Test public void test_literal_trueNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_true.nt"), true); } + @Test public void test_literal_true() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_true.ttl"), true); } + @Test public void test_literal_with_BACKSPACENT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_BACKSPACE.nt"), false); } + @Test public void test_literal_with_BACKSPACE() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_BACKSPACE.ttl"), true); } + @Test public void test_literal_with_CARRIAGE_RETURNNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_CARRIAGE_RETURN.nt"), true); } + @Test public void test_literal_with_CARRIAGE_RETURN() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_CARRIAGE_RETURN.ttl"), true); } + @Test public void test_literal_with_CHARACTER_TABULATIONNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_CHARACTER_TABULATION.nt"), true); } + @Test public void test_literal_with_CHARACTER_TABULATION() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_CHARACTER_TABULATION.ttl"), true); } + @Test public void test_literal_with_escaped_BACKSPACE() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_escaped_BACKSPACE.ttl"), false); } + @Test public void test_literal_with_escaped_CARRIAGE_RETURN() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_escaped_CARRIAGE_RETURN.ttl"), true); } + @Test public void test_literal_with_escaped_CHARACTER_TABULATION() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_escaped_CHARACTER_TABULATION.ttl"), true); } + @Test public void test_literal_with_escaped_FORM_FEED() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_escaped_FORM_FEED.ttl"), true); } + @Test public void test_literal_with_escaped_LINE_FEED() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_escaped_LINE_FEED.ttl"), true); } -// @Test + + // @Test // public void test_literal_with_FORM_FEEDNT() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "literal_with_FORM_FEED.nt"), true); // } @@ -293,63 +357,78 @@ public class TurtleTests { public void test_literal_with_FORM_FEED() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_FORM_FEED.ttl"), true); } + @Test public void test_literal_with_LINE_FEEDNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_LINE_FEED.nt"), true); } + @Test public void test_literal_with_LINE_FEED() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_LINE_FEED.ttl"), true); } + @Test public void test_literal_with_numeric_escape4NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_numeric_escape4.nt"), true); } + @Test public void test_literal_with_numeric_escape4() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_numeric_escape4.ttl"), true); } + @Test public void test_literal_with_numeric_escape8() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_numeric_escape8.ttl"), true); } + @Test public void test_literal_with_REVERSE_SOLIDUSNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_REVERSE_SOLIDUS.nt"), false); } + @Test public void test_literal_with_REVERSE_SOLIDUS() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "literal_with_REVERSE_SOLIDUS.ttl"), true); } + @Test public void test_LITERAL_with_UTF8_boundariesNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL_with_UTF8_boundaries.nt"), true); } + @Test public void test_LITERAL1NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL1.nt"), true); } + @Test public void test_LITERAL1() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL1.ttl"), true); } + @Test public void test_LITERAL1_all_controlsNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL1_all_controls.nt"), false); } + @Test public void test_LITERAL1_all_controls() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL1_all_controls.ttl"), true); } + @Test public void test_LITERAL1_all_punctuationNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL1_all_punctuation.nt"), true); } + @Test public void test_LITERAL1_all_punctuation() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL1_all_punctuation.ttl"), true); } -// @Test + + // @Test // public void test_LITERAL1_ascii_boundariesNT() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "LITERAL1_ascii_boundaries.nt"), true); // } @@ -357,43 +436,53 @@ public class TurtleTests { public void test_LITERAL1_ascii_boundaries() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL1_ascii_boundaries.ttl"), true); } + @Test public void test_LITERAL1_with_UTF8_boundaries() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL1_with_UTF8_boundaries.ttl"), true); } + @Test public void test_LITERAL2() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL2.ttl"), true); } + @Test public void test_LITERAL2_ascii_boundariesNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL2_ascii_boundaries.nt"), false); } + @Test public void test_LITERAL2_ascii_boundaries() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL2_ascii_boundaries.ttl"), true); } + @Test public void test_LITERAL2_with_UTF8_boundaries() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "LITERAL2_with_UTF8_boundaries.ttl"), true); } + @Test public void test_localName_with_assigned_nfc_bmp_PN_CHARS_BASE_character_boundariesNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "localName_with_assigned_nfc_bmp_PN_CHARS_BASE_character_boundaries.nt"), true); } + @Test public void test_localName_with_assigned_nfc_bmp_PN_CHARS_BASE_character_boundaries() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "localName_with_assigned_nfc_bmp_PN_CHARS_BASE_character_boundaries.ttl"), true); } + @Test public void test_localName_with_assigned_nfc_PN_CHARS_BASE_character_boundariesNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "localName_with_assigned_nfc_PN_CHARS_BASE_character_boundaries.nt"), true); } + @Test public void test_localName_with_assigned_nfc_PN_CHARS_BASE_character_boundaries() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "localName_with_assigned_nfc_PN_CHARS_BASE_character_boundaries.ttl"), false); } -// don't need to support property names with ':' + + // don't need to support property names with ':' // @Test // public void test_localname_with_COLONNT() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "localname_with_COLON.nt"), true); @@ -406,71 +495,88 @@ public class TurtleTests { public void test_localName_with_leading_digitNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "localName_with_leading_digit.nt"), true); } + @Test public void test_localName_with_leading_digit() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "localName_with_leading_digit.ttl"), true); } + @Test public void test_localName_with_leading_underscoreNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "localName_with_leading_underscore.nt"), true); } + @Test public void test_localName_with_leading_underscore() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "localName_with_leading_underscore.ttl"), true); } + @Test public void test_localName_with_nfc_PN_CHARS_BASE_character_boundariesNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "localName_with_nfc_PN_CHARS_BASE_character_boundaries.nt"), true); } + @Test public void test_localName_with_nfc_PN_CHARS_BASE_character_boundaries() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "localName_with_nfc_PN_CHARS_BASE_character_boundaries.ttl"), false); } + @Test public void test_localName_with_non_leading_extrasNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "localName_with_non_leading_extras.nt"), true); } + @Test public void test_localName_with_non_leading_extras() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "localName_with_non_leading_extras.ttl"), true); } + @Test public void test_negative_numericNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "negative_numeric.nt"), true); } + @Test public void test_negative_numeric() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "negative_numeric.ttl"), true); } + @Test public void test_nested_blankNodePropertyListsNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "nested_blankNodePropertyLists.nt"), true); } + @Test public void test_nested_blankNodePropertyLists() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "nested_blankNodePropertyLists.ttl"), true); } + @Test public void test_nested_collectionNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "nested_collection.nt"), true); } + @Test public void test_nested_collection() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "nested_collection.ttl"), false); } + @Test public void test_number_sign_following_localNameNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "number_sign_following_localName.nt"), true); } + @Test public void test_number_sign_following_localName() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "number_sign_following_localName.ttl"), true); } + @Test public void test_number_sign_following_PNAME_NSNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "number_sign_following_PNAME_NS.nt"), true); } -// @Test + + // @Test // public void test_number_sign_following_PNAME_NS() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "number_sign_following_PNAME_NS.ttl"), true); // } @@ -478,31 +584,38 @@ public class TurtleTests { public void test_numeric_with_leading_0NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "numeric_with_leading_0.nt"), true); } + @Test public void test_numeric_with_leading_0() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "numeric_with_leading_0.ttl"), true); } + @Test public void test_objectList_with_two_objectsNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "objectList_with_two_objects.nt"), true); } + @Test public void test_objectList_with_two_objects() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "objectList_with_two_objects.ttl"), true); } + @Test public void test_old_style_base() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "old_style_base.ttl"), true); } + @Test public void test_old_style_prefix() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "old_style_prefix.ttl"), true); } + @Test public void test_percent_escaped_localNameNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "percent_escaped_localName.nt"), true); } -// @Test + + // @Test // public void test_percent_escaped_localName() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "percent_escaped_localName.ttl"), true); // } @@ -510,19 +623,23 @@ public class TurtleTests { public void test_positive_numericNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "positive_numeric.nt"), true); } + @Test public void test_positive_numeric() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "positive_numeric.ttl"), true); } + @Test public void test_predicateObjectList_with_two_objectListsNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "predicateObjectList_with_two_objectLists.nt"), true); } + @Test public void test_predicateObjectList_with_two_objectLists() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "predicateObjectList_with_two_objectLists.ttl"), true); } -// @Test + + // @Test // public void test_prefix_only_IRI() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "prefix_only_IRI.ttl"), true); // } @@ -530,47 +647,58 @@ public class TurtleTests { public void test_prefix_reassigned_and_usedNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "prefix_reassigned_and_used.nt"), true); } + @Test public void test_prefix_reassigned_and_used() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "prefix_reassigned_and_used.ttl"), true); } + @Test public void test_prefix_with_non_leading_extras() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "prefix_with_non_leading_extras.ttl"), true); } + @Test public void test_prefix_with_PN_CHARS_BASE_character_boundaries() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "prefix_with_PN_CHARS_BASE_character_boundaries.ttl"), true); } + @Test public void test_prefixed_IRI_object() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "prefixed_IRI_object.ttl"), true); } + @Test public void test_prefixed_IRI_predicate() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "prefixed_IRI_predicate.ttl"), true); } + @Test public void test_prefixed_name_datatype() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "prefixed_name_datatype.ttl"), true); } + @Test public void test_repeated_semis_at_end() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "repeated_semis_at_end.ttl"), true); } + @Test public void test_repeated_semis_not_at_endNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "repeated_semis_not_at_end.nt"), true); } + @Test public void test_repeated_semis_not_at_end() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "repeated_semis_not_at_end.ttl"), true); } + @Test public void test_reserved_escaped_localNameNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "reserved_escaped_localName.nt"), true); } -// @Test + + // @Test // public void test_reserved_escaped_localName() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "reserved_escaped_localName.ttl"), true); // } @@ -578,27 +706,33 @@ public class TurtleTests { public void test_sole_blankNodePropertyList() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "sole_blankNodePropertyList.ttl"), true); } + @Test public void test_SPARQL_style_base() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "SPARQL_style_base.ttl"), true); } + @Test public void test_SPARQL_style_prefix() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "SPARQL_style_prefix.ttl"), true); } + @Test public void test_turtle_eval_bad_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-eval-bad-01.ttl"), false); } + @Test public void test_turtle_eval_bad_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-eval-bad-02.ttl"), false); } + @Test public void test_turtle_eval_bad_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-eval-bad-03.ttl"), false); } -// @Test + + // @Test // public void test_turtle_eval_bad_04() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "turtle-eval-bad-04.ttl"), false); // } @@ -606,247 +740,308 @@ public class TurtleTests { public void test_turtle_eval_struct_01NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-eval-struct-01.nt"), true); } + @Test public void test_turtle_eval_struct_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-eval-struct-01.ttl"), true); } + @Test public void test_turtle_eval_struct_02NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-eval-struct-02.nt"), true); } + @Test public void test_turtle_eval_struct_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-eval-struct-02.ttl"), true); } + @Test public void test_turtle_subm_01NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-01.nt"), true); } + @Test public void test_turtle_subm_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-01.ttl"), true); } + @Test public void test_turtle_subm_02NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-02.nt"), true); } + @Test public void test_turtle_subm_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-02.ttl"), true); } + @Test public void test_turtle_subm_03NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-03.nt"), true); } + @Test public void test_turtle_subm_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-03.ttl"), false); } + @Test public void test_turtle_subm_04NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-04.nt"), true); } + @Test public void test_turtle_subm_04() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-04.ttl"), true); } + @Test public void test_turtle_subm_05NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-05.nt"), true); } + @Test public void test_turtle_subm_05() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-05.ttl"), true); } + @Test public void test_turtle_subm_06NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-06.nt"), true); } + @Test public void test_turtle_subm_06() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-06.ttl"), true); } + @Test public void test_turtle_subm_07NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-07.nt"), true); } + @Test public void test_turtle_subm_07() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-07.ttl"), false); } + @Test public void test_NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-08.nt"), true); } + @Test public void test_turtle_subm_08() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-08.ttl"), true); } + @Test public void test_turtle_subm_09NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-09.nt"), true); } + @Test public void test_turtle_subm_09() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-09.ttl"), true); } + @Test public void test_turtle_subm_10NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-10.nt"), true); } + @Test public void test_turtle_subm_10() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-10.ttl"), true); } + @Test public void test_turtle_subm_11NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-11.nt"), true); } + @Test public void test_turtle_subm_11() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-11.ttl"), true); } + @Test public void test_turtle_subm_12NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-12.nt"), true); } + @Test public void test_turtle_subm_12() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-12.ttl"), true); } + @Test public void test_turtle_subm_13NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-13.nt"), true); } + @Test public void test_turtle_subm_13() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-13.ttl"), true); } + @Test public void test_turtle_subm_14NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-14.nt"), true); } + @Test public void test_turtle_subm_14() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-14.ttl"), false); } + @Test public void test_turtle_subm_15NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-15.nt"), true); } + @Test public void test_turtle_subm_15() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-15.ttl"), true); } + @Test public void test_turtle_subm_16NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-16.nt"), true); } + @Test public void test_turtle_subm_16() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-16.ttl"), true); } + @Test public void test_turtle_subm_17NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-17.nt"), true); } + @Test public void test_turtle_subm_17() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-17.ttl"), true); } + @Test public void test_turtle_subm_18NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-18.nt"), false); } + @Test public void test_turtle_subm_18() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-18.ttl"), false); } + @Test public void test_turtle_subm_19NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-19.nt"), true); } + @Test public void test_turtle_subm_19() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-19.ttl"), true); } + @Test public void test_turtle_subm_20NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-20.nt"), true); } + @Test public void test_turtle_subm_20() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-20.ttl"), true); } + @Test public void test_turtle_subm_21NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-21.nt"), true); } + @Test public void test_turtle_subm_21() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-21.ttl"), true); } + @Test public void test_turtle_subm_22NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-22.nt"), true); } + @Test public void test_turtle_subm_22() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-22.ttl"), true); } + @Test public void test_turtle_subm_23NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-23.nt"), true); } + @Test public void test_turtle_subm_23() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-23.ttl"), false); } + @Test public void test_turtle_subm_24NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-24.nt"), true); } + @Test public void test_turtle_subm_24() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-24.ttl"), true); } + @Test public void test_turtle_subm_25NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-25.nt"), true); } + @Test public void test_turtle_subm_25() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-25.ttl"), true); } + @Test public void test_turtle_subm_26NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-26.nt"), true); } + @Test public void test_turtle_subm_26() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-26.ttl"), true); } + @Test public void test_turtle_subm_27NT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-27.nt"), true); } + @Test public void test_turtle_subm_27() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-subm-27.ttl"), false); } + @Test public void test_turtle_syntax_bad_base_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-base-01.ttl"), false); } + @Test public void test_turtle_syntax_bad_base_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-base-02.ttl"), false); } + @Test public void test_turtle_syntax_bad_base_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-base-03.ttl"), false); } -// @Test + + // @Test // public void test_turtle_syntax_bad_blank_label_dot_end() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-blank-label-dot-end.ttl"), false); // } @@ -854,87 +1049,108 @@ public class TurtleTests { public void test_turtle_syntax_bad_esc_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-esc-01.ttl"), false); } + @Test public void test_turtle_syntax_bad_esc_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-esc-02.ttl"), false); } + @Test public void test_turtle_syntax_bad_esc_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-esc-03.ttl"), false); } + @Test public void test_turtle_syntax_bad_esc_04() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-esc-04.ttl"), false); } + @Test public void test_turtle_syntax_bad_kw_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-kw-01.ttl"), false); } + @Test public void test_turtle_syntax_bad_kw_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-kw-02.ttl"), false); } + @Test public void test_turtle_syntax_bad_kw_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-kw-03.ttl"), false); } + @Test public void test_turtle_syntax_bad_kw_04() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-kw-04.ttl"), false); } + @Test public void test_turtle_syntax_bad_kw_05() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-kw-05.ttl"), false); } + @Test public void test_turtle_syntax_bad_lang_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-lang-01.ttl"), false); } + @Test public void test_turtle_syntax_bad_LITERAL2_with_langtag_and_datatype() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-LITERAL2_with_langtag_and_datatype.ttl"), false); } + @Test public void test_turtle_syntax_bad_ln_dash_start() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-ln-dash-start.ttl"), true); } + @Test public void test_turtle_syntax_bad_ln_escape() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-ln-escape.ttl"), false); } + @Test public void test_turtle_syntax_bad_ln_escape_start() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-ln-escape-start.ttl"), false); } + @Test public void test_turtle_syntax_bad_missing_ns_dot_end() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-missing-ns-dot-end.ttl"), false); } + @Test public void test_turtle_syntax_bad_missing_ns_dot_start() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-missing-ns-dot-start.ttl"), false); } + @Test public void test_turtle_syntax_bad_n3_extras_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-n3-extras-01.ttl"), false); } + @Test public void test_turtle_syntax_bad_n3_extras_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-n3-extras-02.ttl"), false); } + @Test public void test_turtle_syntax_bad_n3_extras_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-n3-extras-03.ttl"), false); } + @Test public void test_turtle_syntax_bad_n3_extras_04() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-n3-extras-04.ttl"), false); } + @Test public void test_turtle_syntax_bad_n3_extras_05() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-n3-extras-05.ttl"), false); } -// @Test + + // @Test // public void test_turtle_syntax_bad_n3_extras_06() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-n3-extras-06.ttl"), false); // } @@ -942,71 +1158,88 @@ public class TurtleTests { public void test_turtle_syntax_bad_n3_extras_07() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-n3-extras-07.ttl"), false); } + @Test public void test_turtle_syntax_bad_n3_extras_08() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-n3-extras-08.ttl"), false); } + @Test public void test_turtle_syntax_bad_n3_extras_09() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-n3-extras-09.ttl"), false); } + @Test public void test_turtle_syntax_bad_n3_extras_10() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-n3-extras-10.ttl"), false); } + @Test public void test_turtle_syntax_bad_n3_extras_11() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-n3-extras-11.ttl"), false); } + @Test public void test_turtle_syntax_bad_n3_extras_12() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-n3-extras-12.ttl"), false); } + @Test public void test_turtle_syntax_bad_n3_extras_13() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-n3-extras-13.ttl"), false); } + @Test public void test_turtle_syntax_bad_ns_dot_end() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-ns-dot-end.ttl"), true); } + @Test public void test_turtle_syntax_bad_ns_dot_start() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-ns-dot-start.ttl"), false); } + @Test public void test_turtle_syntax_bad_num_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-num-01.ttl"), false); } + @Test public void test_turtle_syntax_bad_num_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-num-02.ttl"), false); } + @Test public void test_turtle_syntax_bad_num_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-num-03.ttl"), false); } + @Test public void test_turtle_syntax_bad_num_04() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-num-04.ttl"), false); } + @Test public void test_turtle_syntax_bad_num_05() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-num-05.ttl"), false); } + @Test public void test_turtle_syntax_bad_number_dot_in_anon() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-number-dot-in-anon.ttl"), false); } + @Test public void test_turtle_syntax_bad_pname_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-pname-01.ttl"), false); } + @Test public void test_turtle_syntax_bad_pname_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-pname-02.ttl"), false); } -// @Test + + // @Test // public void test_turtle_syntax_bad_pname_03() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-pname-03.ttl"), false); // } @@ -1014,119 +1247,148 @@ public class TurtleTests { public void test_turtle_syntax_bad_prefix_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-prefix-01.ttl"), false); } + @Test public void test_turtle_syntax_bad_prefix_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-prefix-02.ttl"), false); } + @Test public void test_turtle_syntax_bad_prefix_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-prefix-03.ttl"), false); } + @Test public void test_turtle_syntax_bad_prefix_04() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-prefix-04.ttl"), false); } + @Test public void test_turtle_syntax_bad_prefix_05() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-prefix-05.ttl"), false); } + @Test public void test_turtle_syntax_bad_string_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-string-01.ttl"), false); } + @Test public void test_turtle_syntax_bad_string_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-string-02.ttl"), false); } + @Test public void test_turtle_syntax_bad_string_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-string-03.ttl"), false); } + @Test public void test_turtle_syntax_bad_string_04() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-string-04.ttl"), false); } + @Test public void test_turtle_syntax_bad_string_05() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-string-05.ttl"), false); } + @Test public void test_turtle_syntax_bad_string_06() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-string-06.ttl"), false); } + @Test public void test_turtle_syntax_bad_string_07() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-string-07.ttl"), false); } + @Test public void test_turtle_syntax_bad_struct_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-01.ttl"), false); } + @Test public void test_turtle_syntax_bad_struct_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-02.ttl"), false); } + @Test public void test_turtle_syntax_bad_struct_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-03.ttl"), false); } + @Test public void test_turtle_syntax_bad_struct_04() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-04.ttl"), false); } + @Test public void test_turtle_syntax_bad_struct_05() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-05.ttl"), false); } + @Test public void test_turtle_syntax_bad_struct_06() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-06.ttl"), false); } + @Test public void test_turtle_syntax_bad_struct_07() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-07.ttl"), true); } + @Test public void test_turtle_syntax_bad_struct_08() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-08.ttl"), false); } + @Test public void test_turtle_syntax_bad_struct_09() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-09.ttl"), false); } + @Test public void test_turtle_syntax_bad_struct_10() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-10.ttl"), false); } + @Test public void test_turtle_syntax_bad_struct_11() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-11.ttl"), false); } + @Test public void test_turtle_syntax_bad_struct_12() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-12.ttl"), false); } + @Test public void test_turtle_syntax_bad_struct_13() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-13.ttl"), false); } + @Test public void test_turtle_syntax_bad_struct_14() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-14.ttl"), false); } + @Test public void test_turtle_syntax_bad_struct_15() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-15.ttl"), false); } + @Test public void test_turtle_syntax_bad_struct_16() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-16.ttl"), false); } + @Test public void test_turtle_syntax_bad_struct_17() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-struct-17.ttl"), true); } -// @Test + + // @Test // public void test_turtle_syntax_bad_uri_01() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-uri-01.ttl"), false); // } @@ -1134,11 +1396,13 @@ public class TurtleTests { public void test_turtle_syntax_bad_uri_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-uri-02.ttl"), false); } + @Test public void test_turtle_syntax_bad_uri_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-uri-03.ttl"), false); } -// @Test + + // @Test // public void test_turtle_syntax_bad_uri_04() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bad-uri-04.ttl"), false); // } @@ -1150,103 +1414,128 @@ public class TurtleTests { public void test_turtle_syntax_base_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-base-01.ttl"), true); } + @Test public void test_turtle_syntax_base_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-base-02.ttl"), true); } + @Test public void test_turtle_syntax_base_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-base-03.ttl"), true); } + @Test public void test_turtle_syntax_base_04() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-base-04.ttl"), true); } + @Test public void test_turtle_syntax_blank_label() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-blank-label.ttl"), true); } + @Test public void test_turtle_syntax_bnode_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bnode-01.ttl"), true); } + @Test public void test_turtle_syntax_bnode_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bnode-02.ttl"), true); } + @Test public void test_turtle_syntax_bnode_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bnode-03.ttl"), true); } + @Test public void test_turtle_syntax_bnode_04() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bnode-04.ttl"), true); } + @Test public void test_turtle_syntax_bnode_05() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bnode-05.ttl"), true); } + @Test public void test_turtle_syntax_bnode_06() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bnode-06.ttl"), true); } + @Test public void test_turtle_syntax_bnode_07() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bnode-07.ttl"), true); } + @Test public void test_turtle_syntax_bnode_08() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bnode-08.ttl"), true); } + @Test public void test_turtle_syntax_bnode_09() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bnode-09.ttl"), true); } + @Test public void test_turtle_syntax_bnode_10() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-bnode-10.ttl"), true); } + @Test public void test_turtle_syntax_datatypes_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-datatypes-01.ttl"), true); } + @Test public void test_turtle_syntax_datatypes_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-datatypes-02.ttl"), true); } + @Test public void test_turtle_syntax_file_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-file-01.ttl"), true); } + @Test public void test_turtle_syntax_file_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-file-02.ttl"), true); } + @Test public void test_turtle_syntax_file_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-file-03.ttl"), true); } + @Test public void test_turtle_syntax_kw_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-kw-01.ttl"), true); } + @Test public void test_turtle_syntax_kw_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-kw-02.ttl"), true); } + @Test public void test_turtle_syntax_kw_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-kw-03.ttl"), false); } + @Test public void test_turtle_syntax_lists_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-lists-01.ttl"), true); } + @Test public void test_turtle_syntax_lists_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-lists-02.ttl"), true); } -// @Test + + // @Test // public void test_turtle_syntax_lists_03() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-lists-03.ttl"), true); // } @@ -1266,27 +1555,33 @@ public class TurtleTests { public void test_turtle_syntax_ln_dots() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-ln-dots.ttl"), false); } + @Test public void test_turtle_syntax_ns_dots() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-ns-dots.ttl"), true); } + @Test public void test_turtle_syntax_number_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-number-01.ttl"), true); } + @Test public void test_turtle_syntax_number_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-number-02.ttl"), true); } + @Test public void test_turtle_syntax_number_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-number-03.ttl"), true); } + @Test public void test_turtle_syntax_number_04() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-number-04.ttl"), true); } -// @Test + + // @Test // public void test_turtle_syntax_number_05() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-number-05.ttl"), true); // } @@ -1294,11 +1589,13 @@ public class TurtleTests { public void test_turtle_syntax_number_06() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-number-06.ttl"), true); } + @Test public void test_turtle_syntax_number_07() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-number-07.ttl"), true); } -// @Test + + // @Test // public void test_turtle_syntax_number_08() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-number-08.ttl"), true); // } @@ -1306,31 +1603,38 @@ public class TurtleTests { public void test_turtle_syntax_number_09() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-number-09.ttl"), true); } + @Test public void test_turtle_syntax_number_10() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-number-10.ttl"), true); } + @Test public void test_turtle_syntax_number_11() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-number-11.ttl"), true); } + @Test public void test_turtle_syntax_pname_esc_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-pname-esc-01.ttl"), false); } + @Test public void test_turtle_syntax_pname_esc_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-pname-esc-02.ttl"), false); } + @Test public void test_turtle_syntax_pname_esc_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-pname-esc-03.ttl"), false); } + @Test public void test_turtle_syntax_prefix_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-prefix-01.ttl"), true); } -// @Test + + // @Test // public void test_turtle_syntax_prefix_02() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-prefix-02.ttl"), true); // } @@ -1338,11 +1642,13 @@ public class TurtleTests { public void test_turtle_syntax_prefix_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-prefix-03.ttl"), true); } + @Test public void test_turtle_syntax_prefix_04() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-prefix-04.ttl"), true); } -// @Test + + // @Test // public void test_turtle_syntax_prefix_05() throws Exception { // doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-prefix-05.ttl"), true); // } @@ -1354,166 +1660,207 @@ public class TurtleTests { public void test_turtle_syntax_prefix_07() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-prefix-07.ttl"), true); } + @Test public void test_turtle_syntax_prefix_08() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-prefix-08.ttl"), true); } + @Test public void test_turtle_syntax_prefix_09() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-prefix-09.ttl"), true); } + @Test public void test_turtle_syntax_str_esc_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-str-esc-01.ttl"), true); } + @Test public void test_turtle_syntax_str_esc_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-str-esc-02.ttl"), true); } + @Test public void test_turtle_syntax_str_esc_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-str-esc-03.ttl"), true); } + @Test public void test_turtle_syntax_string_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-string-01.ttl"), true); } + @Test public void test_turtle_syntax_string_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-string-02.ttl"), true); } + @Test public void test_turtle_syntax_string_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-string-03.ttl"), true); } + @Test public void test_turtle_syntax_string_04() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-string-04.ttl"), true); } + @Test public void test_turtle_syntax_string_05() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-string-05.ttl"), true); } + @Test public void test_turtle_syntax_string_06() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-string-06.ttl"), true); } + @Test public void test_turtle_syntax_string_07() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-string-07.ttl"), true); } + @Test public void test_turtle_syntax_string_08() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-string-08.ttl"), true); } + @Test public void test_turtle_syntax_string_09() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-string-09.ttl"), true); } + @Test public void test_turtle_syntax_string_10() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-string-10.ttl"), true); } + @Test public void test_turtle_syntax_string_11() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-string-11.ttl"), true); } + @Test public void test_turtle_syntax_struct_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-struct-01.ttl"), true); } + @Test public void test_turtle_syntax_struct_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-struct-02.ttl"), true); } + @Test public void test_turtle_syntax_struct_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-struct-03.ttl"), true); } + @Test public void test_turtle_syntax_struct_04() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-struct-04.ttl"), true); } + @Test public void test_turtle_syntax_struct_05() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-struct-05.ttl"), true); } + @Test public void test_turtle_syntax_uri_01() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-uri-01.ttl"), true); } + @Test public void test_turtle_syntax_uri_02() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-uri-02.ttl"), true); } + @Test public void test_turtle_syntax_uri_03() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-uri-03.ttl"), true); } + @Test public void test_turtle_syntax_uri_04() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "turtle-syntax-uri-04.ttl"), true); } + @Test public void test_two_LITERAL_LONG2sNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "two_LITERAL_LONG2s.nt"), true); } + @Test public void test_two_LITERAL_LONG2s() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "two_LITERAL_LONG2s.ttl"), true); } + @Test public void test_underscore_in_localNameNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "underscore_in_localName.nt"), true); } + @Test public void test_underscore_in_localName() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "underscore_in_localName.ttl"), true); } + @Test public void test_anonymous_blank_node_object() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "anonymous_blank_node_object.ttl"), true); } + @Test public void test_anonymous_blank_node_subject() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "anonymous_blank_node_subject.ttl"), true); } + @Test public void test_bareword_a_predicateNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "bareword_a_predicate.nt"), true); } + @Test public void test_bareword_a_predicate() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "bareword_a_predicate.ttl"), true); } + @Test public void test_bareword_decimalNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "bareword_decimal.nt"), true); } + @Test public void test_bareword_decimal() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "bareword_decimal.ttl"), true); } + @Test public void test_bareword_doubleNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "bareword_double.nt"), true); } + @Test public void test_bareword_double() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "bareword_double.ttl"), true); } + @Test public void test_bareword_integer() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "bareword_integer.ttl"), true); } + @Test public void test_blankNodePropertyList_as_objectNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "blankNodePropertyList_as_object.nt"), true); } + @Test public void test_blankNodePropertyList_as_object() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "blankNodePropertyList_as_object.ttl"), true); } + @Test public void test_blankNodePropertyList_as_subjectNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "blankNodePropertyList_as_subject.nt"), true); @@ -1527,46 +1874,57 @@ public class TurtleTests { public void test_blankNodePropertyList_containing_collectionNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "blankNodePropertyList_containing_collection.nt"), true); } + @Test public void test_blankNodePropertyList_containing_collection() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "blankNodePropertyList_containing_collection.ttl"), true); } + @Test public void test_blankNodePropertyList_with_multiple_triplesNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "blankNodePropertyList_with_multiple_triples.nt"), true); } + @Test public void test_blankNodePropertyList_with_multiple_triples() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "blankNodePropertyList_with_multiple_triples.ttl"), true); } + @Test public void test_collection_objectNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "collection_object.nt"), true); } + @Test public void test_collection_object() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "collection_object.ttl"), true); } + @Test public void test_collection_subjectNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "collection_subject.nt"), true); } + @Test public void test_collection_subject() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "collection_subject.ttl"), false); } + @Test public void test_comment_following_localName() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "comment_following_localName.ttl"), true); } + @Test public void test_comment_following_PNAME_NSNT() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "comment_following_PNAME_NS.nt"), true); } + @Test public void test_comment_following_PNAME_NS() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "comment_following_PNAME_NS.ttl"), false); } + @Test public void test__default_namespace_IRI() throws Exception { doTest(TestingUtilities.loadTestResource("turtle", "default_namespace_IRI.ttl"), true); diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/UtilitiesTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/UtilitiesTests.java index b074a0e9a..6307d11d2 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/UtilitiesTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/UtilitiesTests.java @@ -1,11 +1,6 @@ package org.hl7.fhir.r5.test; -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; - import org.apache.commons.lang3.SystemUtils; - import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.xhtml.XhtmlComposer; import org.hl7.fhir.utilities.xhtml.XhtmlNode; @@ -14,6 +9,9 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import java.io.File; +import java.io.IOException; + public class UtilitiesTests { private static final String XHTML_SIMPLE = "
Some Text
"; @@ -108,7 +106,7 @@ public class UtilitiesTests { @Test public void testXhtmlLangAttributes() throws IOException { run(XHTML_SIMPLE); - run(XHTML_LANGS); + run(XHTML_LANGS); } public void run(String src) throws IOException { diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ValidationTestConvertor.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ValidationTestConvertor.java index e7589ebef..6e6cd34aa 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ValidationTestConvertor.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/ValidationTestConvertor.java @@ -1,11 +1,5 @@ package org.hl7.fhir.r5.test; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; - import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.r5.context.SimpleWorkerContext; import org.hl7.fhir.r5.elementmodel.Element; @@ -14,46 +8,51 @@ import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat; import org.hl7.fhir.r5.formats.IParser.OutputStyle; import org.hl7.fhir.utilities.Utilities; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; + public class ValidationTestConvertor { - /** - * @param args - * @throws FHIRException - * @throws IOException - * @throws FileNotFoundException - */ - public static void main(String[] args) throws FileNotFoundException, IOException, FHIRException { - SimpleWorkerContext context = SimpleWorkerContext.fromPack("C:\\work\\org.hl7.fhir\\build\\publish\\validation-min.xml.zip"); - for (File f : new File("C:\\work\\org.hl7.fhir\\build\\tests\\validation-examples").listFiles()) { - if (f.getAbsolutePath().endsWith(".xml")) { - File t = new File(Utilities.changeFileExt(f.getAbsolutePath(), ".ttl")); - if (!t.exists()) { - try { - System.out.print("Process "+f.getAbsolutePath()); - Element e = Manager.parse(context, new FileInputStream(f), FhirFormat.XML); - Manager.compose(context, e, new FileOutputStream(t), FhirFormat.TURTLE, OutputStyle.PRETTY, null); - System.out.println(" .... success"); - } catch (Exception e) { - System.out.println(" .... fail: "+e.getMessage()); - } - } - } - if (f.getAbsolutePath().endsWith(".json")) { - if (!new File(Utilities.changeFileExt(f.getAbsolutePath(), ".ttl")).exists()) { - File t = new File(Utilities.changeFileExt(f.getAbsolutePath(), ".ttl")); - if (!t.exists()) { - try { - System.out.print("Process "+f.getAbsolutePath()); - Element e = Manager.parse(context, new FileInputStream(f), FhirFormat.JSON); - Manager.compose(context, e, new FileOutputStream(t), FhirFormat.TURTLE, OutputStyle.PRETTY, null); - System.out.println(" .... success"); - } catch (Exception e) { - System.out.println(" .... fail: "+e.getMessage()); - } - } - } - } - } - } - + /** + * @param args + * @throws FHIRException + * @throws IOException + * @throws FileNotFoundException + */ + public static void main(String[] args) throws FileNotFoundException, IOException, FHIRException { + SimpleWorkerContext context = SimpleWorkerContext.fromPack("C:\\work\\org.hl7.fhir\\build\\publish\\validation-min.xml.zip"); + for (File f : new File("C:\\work\\org.hl7.fhir\\build\\tests\\validation-examples").listFiles()) { + if (f.getAbsolutePath().endsWith(".xml")) { + File t = new File(Utilities.changeFileExt(f.getAbsolutePath(), ".ttl")); + if (!t.exists()) { + try { + System.out.print("Process " + f.getAbsolutePath()); + Element e = Manager.parse(context, new FileInputStream(f), FhirFormat.XML); + Manager.compose(context, e, new FileOutputStream(t), FhirFormat.TURTLE, OutputStyle.PRETTY, null); + System.out.println(" .... success"); + } catch (Exception e) { + System.out.println(" .... fail: " + e.getMessage()); + } + } + } + if (f.getAbsolutePath().endsWith(".json")) { + if (!new File(Utilities.changeFileExt(f.getAbsolutePath(), ".ttl")).exists()) { + File t = new File(Utilities.changeFileExt(f.getAbsolutePath(), ".ttl")); + if (!t.exists()) { + try { + System.out.print("Process " + f.getAbsolutePath()); + Element e = Manager.parse(context, new FileInputStream(f), FhirFormat.JSON); + Manager.compose(context, e, new FileOutputStream(t), FhirFormat.TURTLE, OutputStyle.PRETTY, null); + System.out.println(" .... success"); + } catch (Exception e) { + System.out.println(" .... fail: " + e.getMessage()); + } + } + } + } + } + } } diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/misc/StructureMapTests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/misc/StructureMapTests.java index 75ea6f711..83ab1f508 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/misc/StructureMapTests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/misc/StructureMapTests.java @@ -1,34 +1,24 @@ package org.hl7.fhir.r5.test.misc; -import java.io.File; +import org.hl7.fhir.exceptions.FHIRException; +import org.hl7.fhir.exceptions.FHIRFormatError; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +import javax.xml.parsers.ParserConfigurationException; import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.List; +import java.util.stream.Stream; -import javax.xml.parsers.ParserConfigurationException; - -import org.hl7.fhir.exceptions.FHIRException; -import org.hl7.fhir.exceptions.FHIRFormatError; -import org.hl7.fhir.r5.context.SimpleWorkerContext; -import org.hl7.fhir.r5.model.StructureMap; -import org.hl7.fhir.r5.test.utils.TestingUtilities; -import org.hl7.fhir.r5.utils.StructureMapUtilities; -import org.hl7.fhir.utilities.TextFile; -import org.hl7.fhir.utilities.Utilities; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; - -import junit.framework.Assert; - -@RunWith(Parameterized.class) +@Disabled public class StructureMapTests { - @Parameters(name = "{index}: file {0}") - public static Iterable data() throws ParserConfigurationException, IOException, FHIRFormatError { - + public static Stream data() throws ParserConfigurationException, IOException, FHIRFormatError { + List files = new ArrayList<>(); // File dir = new File(Utilities.path(TestingUtilities.home(), "implementations", "r3maps", "R3toR4")); // for (File f : dir.listFiles()) @@ -38,22 +28,16 @@ public class StructureMapTests { // for (File f : dir.listFiles()) // if (f.getName().endsWith(".map")) // files.add(f.getAbsolutePath()); - List objects = new ArrayList(files.size()); -// + List objects = new ArrayList<>(); // for (String fn : files) { // objects.add(new Object[] { new File(fn).getName(), fn }); // } - return objects; + return objects.stream(); } - private String filename; - public StructureMapTests(String name, String filename) { - this.filename = filename; - } - - @SuppressWarnings("deprecation") - @Test - public void test() throws FHIRException, FileNotFoundException, IOException { + @ParameterizedTest + @MethodSource("data") + public void test(String name, String filename) throws FHIRException, FileNotFoundException, IOException { // if (TestingUtilities.context == null) { // TestingUtilities.context = SimpleWorkerContext.fromPack(Utilities.path(TestingUtilities.content(), "definitions.xml.zip")); // } @@ -68,7 +52,7 @@ public class StructureMapTests { // String s = TestingUtilities.checkTextIsSame(source, output); // Assert.assertTrue(s, s == null); } - + // private void testParse(String path) throws FileNotFoundException, IOException, FHIRException { // if (TestingUtilities.context == null) // TestingUtilities.context = SimpleWorkerContext.fromPack(Utilities.path(TestingUtilities.content(), "definitions.xml.zip")); @@ -77,7 +61,7 @@ public class StructureMapTests { // StructureMap map = scm.parse(TextFile.fileToString(Utilities.path(TestingUtilities.home(), path)), path); // TextFile.stringToFile(scm.render(map), Utilities.path(TestingUtilities.home(), path+".out")); // } - + // @Test // public void testParseAny() throws FHIRException, IOException { // testParse("guides\\ccda2\\mapping\\map\\any.map"); diff --git a/org.hl7.fhir.utilities/pom.xml b/org.hl7.fhir.utilities/pom.xml index 0ffe82eae..d7b407a46 100644 --- a/org.hl7.fhir.utilities/pom.xml +++ b/org.hl7.fhir.utilities/pom.xml @@ -60,6 +60,19 @@ true + + + org.junit.jupiter + junit-jupiter-api + ${junit_jupiter_version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit_jupiter_version} + test + diff --git a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/AllUtilitiesTests.java b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/AllUtilitiesTests.java deleted file mode 100644 index 3abafb351..000000000 --- a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/AllUtilitiesTests.java +++ /dev/null @@ -1,15 +0,0 @@ -package org.hl7.fhir.utilities.tests; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite.SuiteClasses; -import org.junit.runners.Suite; - -@RunWith(Suite.class) -@SuiteClasses({ - JsonParserTests.class, - XhtmlNodeTest.class, - XLSXmlNormaliserTests.class}) - -public class AllUtilitiesTests { - -} diff --git a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/JsonParserTests.java b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/JsonParserTests.java index 3b8bbb9e8..c46411fcd 100644 --- a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/JsonParserTests.java +++ b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/JsonParserTests.java @@ -1,11 +1,9 @@ package org.hl7.fhir.utilities.tests; -import static org.junit.Assert.*; - import java.io.IOException; import org.hl7.fhir.utilities.json.JsonTrackingParser; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class JsonParserTests { diff --git a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/XLSXmlNormaliserTests.java b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/XLSXmlNormaliserTests.java index 8e6b8ebeb..e5d482f8f 100644 --- a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/XLSXmlNormaliserTests.java +++ b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/XLSXmlNormaliserTests.java @@ -7,11 +7,10 @@ import javax.xml.transform.TransformerException; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.utilities.xls.XLSXmlNormaliser; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; - public class XLSXmlNormaliserTests { @Test @@ -20,7 +19,6 @@ public class XLSXmlNormaliserTests { n.go(); // n = new XLSXmlNormaliser("C:\\work\\org.hl7.fhir\\build\\source\\observation\\observation-spreadsheet.before.xml", "C:\\\\work\\\\org.hl7.fhir\\\\build\\\\source\\\\observation\\\\observation-spreadsheet.before.out.xml", true); // n.go(); - Assert.assertTrue(true); + Assertions.assertTrue(true); } - } diff --git a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/XhtmlNodeTest.java b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/XhtmlNodeTest.java index 646196d01..341189cf5 100644 --- a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/XhtmlNodeTest.java +++ b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/XhtmlNodeTest.java @@ -1,12 +1,13 @@ package org.hl7.fhir.utilities.tests; +import org.hl7.fhir.utilities.xhtml.XhtmlNode; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; -import org.hl7.fhir.utilities.xhtml.XhtmlNode; -import org.junit.Test; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import static org.junit.Assert.assertEquals; @@ -29,7 +30,6 @@ public class XhtmlNodeTest { node = new XhtmlNode(); node.setValueAsString("
<
"); assertEquals("
<
", node.getValueAsString()); - } /** diff --git a/org.hl7.fhir.validation/pom.xml b/org.hl7.fhir.validation/pom.xml index cf8e5731d..eb7118f58 100644 --- a/org.hl7.fhir.validation/pom.xml +++ b/org.hl7.fhir.validation/pom.xml @@ -164,10 +164,17 @@ thymeleaf 3.0.9.RELEASE + org.junit.jupiter - junit-jupiter - RELEASE + junit-jupiter-api + ${junit_jupiter_version} + test + + + org.junit.jupiter + junit-jupiter-params + ${junit_jupiter_version} test diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/model/CliContext.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/model/CliContext.java index 951628ffa..2eea1537d 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/model/CliContext.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/model/CliContext.java @@ -405,5 +405,42 @@ public class CliContext { this.noExtensibleBindingMessages = noExtensibleBindingMessages; return this; } - + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + CliContext that = (CliContext) o; + return doNative == that.doNative && + anyExtensionsAllowed == that.anyExtensionsAllowed && + hintAboutNonMustSupport == that.hintAboutNonMustSupport && + recursive == that.recursive && + doDebug == that.doDebug && + assumeValidRestReferences == that.assumeValidRestReferences && + canDoNative == that.canDoNative && + noInternalCaching == that.noInternalCaching && + noExtensibleBindingMessages == that.noExtensibleBindingMessages && + Objects.equals(map, that.map) && + Objects.equals(output, that.output) && + Objects.equals(txServer, that.txServer) && + Objects.equals(sv, that.sv) && + Objects.equals(txLog, that.txLog) && + Objects.equals(mapLog, that.mapLog) && + Objects.equals(lang, that.lang) && + Objects.equals(fhirpath, that.fhirpath) && + Objects.equals(snomedCT, that.snomedCT) && + Objects.equals(targetVer, that.targetVer) && + Objects.equals(igs, that.igs) && + Objects.equals(questionnaires, that.questionnaires) && + Objects.equals(profiles, that.profiles) && + Objects.equals(sources, that.sources) && + mode == that.mode && + Objects.equals(locale, that.locale) && + Objects.equals(locations, that.locations); + } + + @Override + public int hashCode() { + return Objects.hash(doNative, anyExtensionsAllowed, hintAboutNonMustSupport, recursive, doDebug, assumeValidRestReferences, canDoNative, noInternalCaching, noExtensibleBindingMessages, map, output, txServer, sv, txLog, mapLog, lang, fhirpath, snomedCT, targetVer, igs, questionnaires, profiles, sources, mode, locale, locations); + } } diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/conversion/tests/SnapShotGenerationTestsX.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/conversion/tests/SnapShotGenerationTestsX.java index 0af08409e..222b67cff 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/conversion/tests/SnapShotGenerationTestsX.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/conversion/tests/SnapShotGenerationTestsX.java @@ -1,14 +1,5 @@ package org.hl7.fhir.conversion.tests; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.parsers.ParserConfigurationException; - import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.NotImplementedException; import org.hl7.fhir.exceptions.DefinitionException; @@ -37,41 +28,49 @@ import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; import org.hl7.fhir.utilities.xml.XMLUtil; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.SAXException; -import junit.framework.Assert; +import javax.xml.parsers.ParserConfigurationException; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; -@RunWith(Parameterized.class) public class SnapShotGenerationTestsX { public enum TestFetchMode { INPUT, - OUTPUT, + OUTPUT, INCLUDE } public static class Rule { private String description; private String expression; + public Rule(String description, String expression) { super(); this.description = description; this.expression = expression; } + public Rule(Element rule) { super(); this.description = rule.getAttribute("text"); this.expression = rule.getAttribute("fhirpath"); } + public String getDescription() { return description; } + public String getExpression() { return expression; } @@ -89,7 +88,7 @@ public class SnapShotGenerationTestsX { private boolean newSliceProcessing; private boolean debug; private String version; - + private List rules = new ArrayList<>(); private StructureDefinition source; private StructureDefinition included; @@ -103,7 +102,7 @@ public class SnapShotGenerationTestsX { fail = "true".equals(test.getAttribute("fail")); newSliceProcessing = !"false".equals(test.getAttribute("new-slice-processing")); debug = "true".equals(test.getAttribute("debug")); - + id = test.getAttribute("id"); include = test.getAttribute("include"); register = test.getAttribute("register"); @@ -115,65 +114,81 @@ public class SnapShotGenerationTestsX { rule = XMLUtil.getNextSibling(rule); } } + public String getId() { return id; } + public boolean isSort() { return sort; } + public boolean isGen() { return gen; } + public String getInclude() { return include; } + public boolean isFail() { return fail; } + public StructureDefinition getIncluded() { return included; } + public List getRules() { return rules; } + public StructureDefinition getSource() { return source; } + public void setSource(StructureDefinition source) { this.source = source; } + public StructureDefinition getExpected() { return expected; } + public void setExpected(StructureDefinition expected) { this.expected = expected; } + public StructureDefinition getOutput() { return output; } + public void setOutput(StructureDefinition output) { this.output = output; } + public void load() throws FHIRFormatError, FileNotFoundException, IOException { - if (TestingUtilitiesX.findTestResource("rX", "snapshot-generation", id+"-input.json")) - source = (StructureDefinition) new JsonParser().parse(TestingUtilitiesX.loadTestResourceStream("rX", "snapshot-generation", id+"-input.json")); + if (TestingUtilitiesX.findTestResource("rX", "snapshot-generation", id + "-input.json")) + source = (StructureDefinition) new JsonParser().parse(TestingUtilitiesX.loadTestResourceStream("rX", "snapshot-generation", id + "-input.json")); else - source = (StructureDefinition) new XmlParser().parse(TestingUtilitiesX.loadTestResourceStream("rX", "snapshot-generation", id+"-input.xml")); + source = (StructureDefinition) new XmlParser().parse(TestingUtilitiesX.loadTestResourceStream("rX", "snapshot-generation", id + "-input.xml")); if (!fail) - expected = (StructureDefinition) new XmlParser().parse(TestingUtilitiesX.loadTestResourceStream("rX", "snapshot-generation", id+"-expected.xml")); + expected = (StructureDefinition) new XmlParser().parse(TestingUtilitiesX.loadTestResourceStream("rX", "snapshot-generation", id + "-expected.xml")); if (!Utilities.noString(include)) - included = (StructureDefinition) new XmlParser().parse(TestingUtilitiesX.loadTestResourceStream("rX", "snapshot-generation", include+".xml")); + included = (StructureDefinition) new XmlParser().parse(TestingUtilitiesX.loadTestResourceStream("rX", "snapshot-generation", include + ".xml")); if (!Utilities.noString(register)) { - if (TestingUtilitiesX.findTestResource("rX", "snapshot-generation", register+".xml")) { - included = (StructureDefinition) new XmlParser().parse(TestingUtilitiesX.loadTestResourceStream("rX", "snapshot-generation", register+".xml")); + if (TestingUtilitiesX.findTestResource("rX", "snapshot-generation", register + ".xml")) { + included = (StructureDefinition) new XmlParser().parse(TestingUtilitiesX.loadTestResourceStream("rX", "snapshot-generation", register + ".xml")); } else { - included = (StructureDefinition) new JsonParser().parse(TestingUtilitiesX.loadTestResourceStream("rX", "snapshot-generation", register+".json")); + included = (StructureDefinition) new JsonParser().parse(TestingUtilitiesX.loadTestResourceStream("rX", "snapshot-generation", register + ".json")); } } } + public boolean isNewSliceProcessing() { return newSliceProcessing; } + public boolean isDebug() { return debug; } @@ -184,13 +199,13 @@ public class SnapShotGenerationTestsX { @Override public boolean isDatatype(String name) { StructureDefinition sd = TestingUtilitiesX.context(version).fetchTypeDefinition(name); - return (sd != null) && (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) && (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE || sd.getKind() == StructureDefinitionKind.COMPLEXTYPE); + return (sd != null) && (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) && (sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE || sd.getKind() == StructureDefinitionKind.COMPLEXTYPE); } @Override public boolean isResource(String typeSimple) { StructureDefinition sd = TestingUtilitiesX.context(version).fetchTypeDefinition(typeSimple); - return (sd != null) && (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) && (sd.getKind() == StructureDefinitionKind.RESOURCE); + return (sd != null) && (sd.getDerivation() == TypeDerivationRule.SPECIALIZATION) && (sd.getKind() == StructureDefinitionKind.RESOURCE); } @Override @@ -200,13 +215,13 @@ public class SnapShotGenerationTestsX { @Override public String getLinkFor(String corePath, String typeSimple) { - return Utilities.pathURL(corePath, "datatypes.html#"+typeSimple); + return Utilities.pathURL(corePath, "datatypes.html#" + typeSimple); } @Override public BindingResolution resolveBinding(StructureDefinition def, ElementDefinitionBindingComponent binding, String path) throws FHIRException { BindingResolution br = new BindingResolution(); - br.url = path+"/something.html"; + br.url = path + "/something.html"; br.display = "something"; return br; } @@ -214,7 +229,7 @@ public class SnapShotGenerationTestsX { @Override public BindingResolution resolveBinding(StructureDefinition def, String url, String path) throws FHIRException { BindingResolution br = new BindingResolution(); - br.url = path+"/something.html"; + br.url = path + "/something.html"; br.display = "something"; return br; } @@ -223,9 +238,9 @@ public class SnapShotGenerationTestsX { public String getLinkForProfile(StructureDefinition profile, String url) { StructureDefinition sd = TestingUtilitiesX.context(version).fetchResource(StructureDefinition.class, url); if (sd == null) - return url+"|"+url; + return url + "|" + url; else - return sd.getId()+".html|"+sd.present(); + return sd.getId() + ".html|" + sd.present(); } @Override @@ -256,7 +271,7 @@ public class SnapShotGenerationTestsX { return TestingUtilitiesX.context(version).fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/OperationOutcome"); if (id.equals("parameters")) return TestingUtilitiesX.context(version).fetchResource(StructureDefinition.class, "http://hl7.org/fhir/StructureDefinition/Parameters"); - + if (id.contains("-")) { String[] p = id.split("\\-"); id = p[0]; @@ -268,15 +283,17 @@ public class SnapShotGenerationTestsX { for (TestDetails td : tests) { if (td.getId().equals(id)) switch (mode) { - case INPUT: return td.getSource(); - case OUTPUT: if (td.getOutput() == null) - throw new FHIRException("Not generated yet"); - else - return td.getOutput(); - case INCLUDE: - return td.getIncluded(); - default: - throw new FHIRException("Not done yet"); + case INPUT: + return td.getSource(); + case OUTPUT: + if (td.getOutput() == null) + throw new FHIRException("Not generated yet"); + else + return td.getOutput(); + case INCLUDE: + return td.getIncluded(); + default: + throw new FHIRException("Not done yet"); } } return null; @@ -295,7 +312,7 @@ public class SnapShotGenerationTestsX { @Override public boolean log(String argument, List focus) { - System.out.println(argument+": "+fp.convertToString(focus)); + System.out.println(argument + ": " + fp.convertToString(focus)); return true; } @@ -323,7 +340,7 @@ public class SnapShotGenerationTestsX { list.add(res); return list; } - throw new Error("Could not resolve "+id); + throw new Error("Could not resolve " + id); } throw new Error("Not implemented yet"); } @@ -369,7 +386,6 @@ public class SnapShotGenerationTestsX { private static FHIRPathEngine fp; - @Parameters(name = "{index}: file {0}") public static Iterable data() throws ParserConfigurationException, IOException, FHIRFormatError, SAXException { SnapShotGenerationTestsContext context = new SnapShotGenerationTestsContext(); @@ -380,80 +396,74 @@ public class SnapShotGenerationTestsX { TestDetails t = new TestDetails(test); context.tests.add(t); t.load(); - objects.add(new Object[] {t.getId(), t, context }); + objects.add(new Object[]{t.getId(), t, context}); test = XMLUtil.getNextSibling(test); } return objects; } - - private final TestDetails test; private SnapShotGenerationTestsContext context; private List messages; private static String version; - - public SnapShotGenerationTestsX(String id, TestDetails test, SnapShotGenerationTestsContext context) { - this.test = test; - this.context = context; - } - @SuppressWarnings("deprecation") - @Test - public void test() throws Exception { + @ParameterizedTest(name = "{index}: file {0}") + @MethodSource("data") + public void test(String id, TestDetails test, SnapShotGenerationTestsContext context) throws Exception { version = test.version; + this.context = context; if (fp == null) fp = new FHIRPathEngine(TestingUtilitiesX.context(version)); fp.setHostServices(context); messages = new ArrayList(); - + if (test.isFail()) { try { if (test.isGen()) - testGen(true); + testGen(true, test); else - testSort(); - Assert.assertTrue("Should have failed", false); + testSort(test); + Assertions.assertTrue(false, "Should have failed"); } catch (Throwable e) { - System.out.println("Error running test: "+e.getMessage()); + System.out.println("Error running test: " + e.getMessage()); if (!Utilities.noString(test.regex)) { - Assert.assertTrue("correct error message", e.getMessage().matches(test.regex)); + Assertions.assertTrue(e.getMessage().matches(test.regex), "correct error message"); } else if ("Should have failed".equals(e.getMessage())) { throw e; } else { - Assert.assertTrue("all ok", true); + Assertions.assertTrue(true, "all ok"); } - + } } else if (test.isGen()) - testGen(false); + testGen(false, test); else - testSort(); + testSort(test); for (Rule r : test.getRules()) { StructureDefinition sdn = new StructureDefinition(); boolean ok = fp.evaluateToBoolean(sdn, sdn, sdn, r.expression); - Assert.assertTrue(r.description, ok); + Assertions.assertTrue(ok, r.description); } } - private void testSort() throws DefinitionException, FHIRException, IOException { - StructureDefinition base = getSD(test.getSource().getBaseDefinition()); + private void testSort(TestDetails test) throws DefinitionException, FHIRException, IOException { + StructureDefinition base = getSD(test.getSource().getBaseDefinition()); test.setOutput(test.getSource().copy()); ProfileUtilities pu = new ProfileUtilities(TestingUtilitiesX.context(version), null, null); pu.setIds(test.getSource(), false); - List errors = new ArrayList(); + List errors = new ArrayList(); pu.sortDifferential(base, test.getOutput(), test.getOutput().getUrl(), errors, false); if (!errors.isEmpty()) throw new FHIRException(errors.get(0)); - IOUtils.copy(TestingUtilitiesX.loadTestResourceStream("rX", "snapshot-generation", test.getId()+"-expected.xml"), new FileOutputStream(TestingUtilitiesX.tempFile("snapshot", test.getId()+"-expected.xml"))); - new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(TestingUtilitiesX.tempFile("snapshot", test.getId()+"-actual.xml")), test.getOutput()); - Assert.assertTrue("Output does not match expected", test.expected.equalsDeep(test.output)); + IOUtils.copy(TestingUtilitiesX.loadTestResourceStream("rX", "snapshot-generation", test.getId() + "-expected.xml"), new FileOutputStream(TestingUtilitiesX.tempFile("snapshot", test.getId() + "-expected.xml"))); + new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(TestingUtilitiesX.tempFile("snapshot", test.getId() + "-actual.xml")), test.getOutput()); + Assertions.assertTrue(test.expected.equalsDeep(test.output), "Output does not match expected"); } - private void testGen(boolean fail) throws Exception { + private void testGen(boolean fail, TestDetails test) throws Exception { if (!Utilities.noString(test.register)) { - List messages = new ArrayList(); + List messages = new ArrayList(); ProfileUtilities pu = new ProfileUtilities(TestingUtilitiesX.context(version), messages, null); pu.setNewSlicingProcessing(true); pu.setIds(test.included, false); @@ -471,14 +481,14 @@ public class SnapShotGenerationTestsX { } } if (ec > 0) - throw new FHIRException("register gen failed: "+messages.toString()); + throw new FHIRException("register gen failed: " + messages.toString()); } - StructureDefinition base = getSD(test.getSource().getBaseDefinition()); + StructureDefinition base = getSD(test.getSource().getBaseDefinition()); if (!base.getUrl().equals(test.getSource().getBaseDefinition())) - throw new Exception("URL mismatch on base: "+base.getUrl()+" wanting "+test.getSource().getBaseDefinition()); - + throw new Exception("URL mismatch on base: " + base.getUrl() + " wanting " + test.getSource().getBaseDefinition()); + StructureDefinition output = test.getSource().copy(); - ProfileUtilities pu = new ProfileUtilities(TestingUtilitiesX.context(version), messages , new TestPKP()); + ProfileUtilities pu = new ProfileUtilities(TestingUtilitiesX.context(version), messages, new TestPKP()); pu.setNewSlicingProcessing(test.isNewSliceProcessing()); pu.setThrowException(false); pu.setDebug(test.isDebug()); @@ -488,7 +498,7 @@ public class SnapShotGenerationTestsX { int lastCount = output.getDifferential().getElement().size(); pu.sortDifferential(base, output, test.getSource().getName(), errors, false); if (errors.size() > 0) - throw new FHIRException("Sort failed: "+errors.toString()); + throw new FHIRException("Sort failed: " + errors.toString()); } try { messages.clear(); @@ -500,10 +510,10 @@ public class SnapShotGenerationTestsX { } } if (ml.size() > 0) { - throw new FHIRException("Snapshot Generation failed: "+ml.toString()); + throw new FHIRException("Snapshot Generation failed: " + ml.toString()); } } catch (Throwable e) { - System.out.println("\r\nException: "+e.getMessage()); + System.out.println("\r\nException: " + e.getMessage()); throw e; } if (output.getDifferential().hasElement()) @@ -511,16 +521,16 @@ public class SnapShotGenerationTestsX { if (!fail) { test.output = output; TestingUtilitiesX.context(version).cacheResource(output); - File dst = new File(TestingUtilitiesX.tempFile("snapshot", test.getId()+"-expected.xml")); + File dst = new File(TestingUtilitiesX.tempFile("snapshot", test.getId() + "-expected.xml")); if (dst.exists()) dst.delete(); - IOUtils.copy(TestingUtilitiesX.loadTestResourceStream("rX", "snapshot-generation", test.getId()+"-expected.xml"), new FileOutputStream(dst)); - new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(TestingUtilitiesX.tempFile("snapshot", test.getId()+"-actual.xml")), output); + IOUtils.copy(TestingUtilitiesX.loadTestResourceStream("rX", "snapshot-generation", test.getId() + "-expected.xml"), new FileOutputStream(dst)); + new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(TestingUtilitiesX.tempFile("snapshot", test.getId() + "-actual.xml")), output); StructureDefinition t1 = test.expected.copy(); t1.setText(null); StructureDefinition t2 = test.output.copy(); t2.setText(null); - Assert.assertTrue("Output does not match expected", t1.equalsDeep(t2)); + Assertions.assertTrue(t1.equalsDeep(t2), "Output does not match expected"); } } @@ -530,9 +540,9 @@ public class SnapShotGenerationTestsX { sd = TestingUtilitiesX.context(version).fetchResource(StructureDefinition.class, url); if (!sd.hasSnapshot()) { StructureDefinition base = getSD(sd.getBaseDefinition()); - ProfileUtilities pu = new ProfileUtilities(TestingUtilitiesX.context(version), messages , new TestPKP()); + ProfileUtilities pu = new ProfileUtilities(TestingUtilitiesX.context(version), messages, new TestPKP()); pu.setNewSlicingProcessing(true); - List errors = new ArrayList(); + List errors = new ArrayList(); pu.sortDifferential(base, sd, url, errors, false); if (!errors.isEmpty()) throw new FHIRException(errors.get(0)); diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/JsonSchemaTests.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/JsonSchemaTests.java index 0a4947a2f..4604d1937 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/JsonSchemaTests.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/JsonSchemaTests.java @@ -1,133 +1,131 @@ package org.hl7.fhir.validation.tests; -import java.io.FileNotFoundException; -import java.io.IOException; - import org.everit.json.schema.Schema; import org.everit.json.schema.ValidationException; import org.everit.json.schema.loader.SchemaLoader; -import org.hl7.fhir.utilities.TextFile; -import org.hl7.fhir.utilities.Utilities; -import org.hl7.fhir.validation.tests.utilities.TestUtilities; import org.json.JSONObject; import org.json.JSONTokener; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.io.FileNotFoundException; +import java.io.IOException; + public class JsonSchemaTests { static private org.everit.json.schema.Schema sFhir; static private org.everit.json.schema.Schema sTest; - - public static final String TEST_SCHEMA = "{\r\n"+ - " \"$schema\": \"http://json-schema.org/draft-06/schema#\",\r\n"+ - // " \"id\": \"http://hl7.org/fhir/test-json-schema/4.0\",\r\n"+ - " \"description\": \"for unit tests\",\r\n"+ - " \"discriminator\": {\r\n"+ - " \"propertyName\": \"resourceType\",\r\n"+ - " \"mapping\": {\r\n"+ - " \"A\": \"#/definitions/A\",\r\n"+ - " \"B\": \"#/definitions/B\"\r\n"+ - " }\r\n"+ - " },\r\n"+ - " \"oneOf\": [\r\n"+ - " {\r\n"+ - " \"$ref\": \"#/definitions/A\"\r\n"+ - " },\r\n"+ - " {\r\n"+ - " \"$ref\": \"#/definitions/B\"\r\n"+ - " }\r\n"+ - " ],\r\n"+ - " \"definitions\": {\r\n"+ - " \"boolean\": {\r\n"+ - " \"pattern\": \"^true|false$\",\r\n"+ - " \"type\": \"boolean\"\r\n"+ - " },\r\n"+ - " \"id\": {\r\n"+ - " \"pattern\": \"^[A-Za-z0-9\\\\-\\\\.]{1,64}$\",\r\n"+ - " \"type\": \"string\"\r\n"+ - " },\r\n"+ - " \"integer\": {\r\n"+ - " \"pattern\": \"^-?([0]|([1-9][0-9]*))$\",\r\n"+ - " \"type\": \"number\"\r\n"+ - " },\r\n"+ - " \"string\": {\r\n"+ - " \"pattern\": \"^[ \\\\r\\\\n\\\\t\\\\S]+$\",\r\n"+ - " \"type\": \"string\"\r\n"+ - " },\r\n"+ - " \"Element\": {\r\n"+ - " \"properties\": {\r\n"+ - " \"id\": {\r\n"+ - " \"$ref\": \"#/definitions/string\"\r\n"+ - " }\r\n"+ - " },\r\n"+ - " \"additionalProperties\": false\r\n"+ - " },\r\n"+ - " \"Coding\": {\r\n"+ - " \"properties\": {\r\n"+ - " \"id\": {\r\n"+ - " \"$ref\": \"#/definitions/string\"\r\n"+ - " },\r\n"+ - " \"system\": {\r\n"+ - " \"$ref\": \"#/definitions/string\"\r\n"+ - " },\r\n"+ - " \"version\": {\r\n"+ - " \"$ref\": \"#/definitions/string\"\r\n"+ - " },\r\n"+ - " \"code\": {\r\n"+ - " \"$ref\": \"#/definitions/string\"\r\n"+ - " },\r\n"+ - " \"display\": {\r\n"+ - " \"$ref\": \"#/definitions/string\"\r\n"+ - " },\r\n"+ - " \"userSelected\": {\r\n"+ - " \"$ref\": \"#/definitions/boolean\"\r\n"+ - " }\r\n"+ - " },\r\n"+ - " \"additionalProperties\": false\r\n"+ - " },\r\n"+ - " \"A\": {\r\n"+ - " \"properties\": {\r\n"+ - " \"resourceType\": {\r\n"+ - " \"const\": \"A\"\r\n"+ - " },\r\n"+ - " \"id\": {\r\n"+ - " \"$ref\": \"#/definitions/id\"\r\n"+ - " }\r\n"+ - " },\r\n"+ - " \"required\": [\r\n"+ - " \"resourceType\"\r\n"+ - " ]\r\n"+ - " },\r\n"+ - " \"B\": {\r\n"+ - " \"properties\": {\r\n"+ - " \"resourceType\": {\r\n"+ - " \"const\": \"B\"\r\n"+ - " },\r\n"+ - " \"code\": {\r\n"+ - " \"$ref\": \"#/definitions/id\"\r\n"+ - " },\r\n"+ - " \"string\": {\r\n"+ - " \"$ref\": \"#/definitions/string\"\r\n"+ - " },\r\n"+ - " \"integer\": {\r\n"+ - " \"$ref\": \"#/definitions/integer\"\r\n"+ - " },\r\n"+ - " \"boolean\": {\r\n"+ - " \"$ref\": \"#/definitions/boolean\"\r\n"+ - " }\r\n"+ - " \r\n"+ - " },\r\n"+ - " \"additionalProperties\": false,\r\n"+ - " \"required\": [\r\n"+ - " \"resourceType\", \"code\"\r\n"+ - " ]\r\n"+ - " }\r\n"+ - " }\r\n"+ - "}\r\n"; - @Before + public static final String TEST_SCHEMA = "{\r\n" + + " \"$schema\": \"http://json-schema.org/draft-06/schema#\",\r\n" + + // " \"id\": \"http://hl7.org/fhir/test-json-schema/4.0\",\r\n"+ + " \"description\": \"for unit tests\",\r\n" + + " \"discriminator\": {\r\n" + + " \"propertyName\": \"resourceType\",\r\n" + + " \"mapping\": {\r\n" + + " \"A\": \"#/definitions/A\",\r\n" + + " \"B\": \"#/definitions/B\"\r\n" + + " }\r\n" + + " },\r\n" + + " \"oneOf\": [\r\n" + + " {\r\n" + + " \"$ref\": \"#/definitions/A\"\r\n" + + " },\r\n" + + " {\r\n" + + " \"$ref\": \"#/definitions/B\"\r\n" + + " }\r\n" + + " ],\r\n" + + " \"definitions\": {\r\n" + + " \"boolean\": {\r\n" + + " \"pattern\": \"^true|false$\",\r\n" + + " \"type\": \"boolean\"\r\n" + + " },\r\n" + + " \"id\": {\r\n" + + " \"pattern\": \"^[A-Za-z0-9\\\\-\\\\.]{1,64}$\",\r\n" + + " \"type\": \"string\"\r\n" + + " },\r\n" + + " \"integer\": {\r\n" + + " \"pattern\": \"^-?([0]|([1-9][0-9]*))$\",\r\n" + + " \"type\": \"number\"\r\n" + + " },\r\n" + + " \"string\": {\r\n" + + " \"pattern\": \"^[ \\\\r\\\\n\\\\t\\\\S]+$\",\r\n" + + " \"type\": \"string\"\r\n" + + " },\r\n" + + " \"Element\": {\r\n" + + " \"properties\": {\r\n" + + " \"id\": {\r\n" + + " \"$ref\": \"#/definitions/string\"\r\n" + + " }\r\n" + + " },\r\n" + + " \"additionalProperties\": false\r\n" + + " },\r\n" + + " \"Coding\": {\r\n" + + " \"properties\": {\r\n" + + " \"id\": {\r\n" + + " \"$ref\": \"#/definitions/string\"\r\n" + + " },\r\n" + + " \"system\": {\r\n" + + " \"$ref\": \"#/definitions/string\"\r\n" + + " },\r\n" + + " \"version\": {\r\n" + + " \"$ref\": \"#/definitions/string\"\r\n" + + " },\r\n" + + " \"code\": {\r\n" + + " \"$ref\": \"#/definitions/string\"\r\n" + + " },\r\n" + + " \"display\": {\r\n" + + " \"$ref\": \"#/definitions/string\"\r\n" + + " },\r\n" + + " \"userSelected\": {\r\n" + + " \"$ref\": \"#/definitions/boolean\"\r\n" + + " }\r\n" + + " },\r\n" + + " \"additionalProperties\": false\r\n" + + " },\r\n" + + " \"A\": {\r\n" + + " \"properties\": {\r\n" + + " \"resourceType\": {\r\n" + + " \"const\": \"A\"\r\n" + + " },\r\n" + + " \"id\": {\r\n" + + " \"$ref\": \"#/definitions/id\"\r\n" + + " }\r\n" + + " },\r\n" + + " \"required\": [\r\n" + + " \"resourceType\"\r\n" + + " ]\r\n" + + " },\r\n" + + " \"B\": {\r\n" + + " \"properties\": {\r\n" + + " \"resourceType\": {\r\n" + + " \"const\": \"B\"\r\n" + + " },\r\n" + + " \"code\": {\r\n" + + " \"$ref\": \"#/definitions/id\"\r\n" + + " },\r\n" + + " \"string\": {\r\n" + + " \"$ref\": \"#/definitions/string\"\r\n" + + " },\r\n" + + " \"integer\": {\r\n" + + " \"$ref\": \"#/definitions/integer\"\r\n" + + " },\r\n" + + " \"boolean\": {\r\n" + + " \"$ref\": \"#/definitions/boolean\"\r\n" + + " }\r\n" + + " \r\n" + + " },\r\n" + + " \"additionalProperties\": false,\r\n" + + " \"required\": [\r\n" + + " \"resourceType\", \"code\"\r\n" + + " ]\r\n" + + " }\r\n" + + " }\r\n" + + "}\r\n"; + + @BeforeEach public void setUp() throws Exception { if (sFhir == null) { // String path = TestUtilities.resourceNameToFile("fhir.schema.json"); // todo... what should this be? @@ -155,11 +153,11 @@ public class JsonSchemaTests { private void pass(String source, Schema schema) throws FileNotFoundException, IOException { - Assert.assertTrue(validateJson(source, schema)); + Assertions.assertTrue(validateJson(source, schema)); } private void fail(String source, Schema schema) throws FileNotFoundException, IOException { - Assert.assertFalse(validateJson(source, schema)); + Assertions.assertFalse(validateJson(source, schema)); } @Test diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/NativeHostServiceTester.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/NativeHostServiceTester.java index 539e1d7ce..38a6b7d0b 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/NativeHostServiceTester.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/NativeHostServiceTester.java @@ -3,7 +3,7 @@ package org.hl7.fhir.validation.tests; import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat; import org.hl7.fhir.r5.test.utils.TestingUtilities; import org.hl7.fhir.validation.NativeHostServices; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class NativeHostServiceTester { diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ProfileComparisonTests.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ProfileComparisonTests.java index 8e2c44e0a..fb025b99a 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ProfileComparisonTests.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ProfileComparisonTests.java @@ -13,7 +13,7 @@ import org.hl7.fhir.utilities.cache.ToolsVersion; import org.hl7.fhir.r5.test.utils.TestingUtilities; import org.hl7.fhir.validation.ValidationEngine; import org.hl7.fhir.validation.tests.utilities.TestUtilities; -import org.junit.Test; +import org.junit.jupiter.api.Test; public class ProfileComparisonTests { diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationEngineTests.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationEngineTests.java index 1b1694b53..5ce2ea3a6 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationEngineTests.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationEngineTests.java @@ -1,8 +1,5 @@ package org.hl7.fhir.validation.tests; -import java.util.ArrayList; -import java.util.List; - import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat; import org.hl7.fhir.r5.model.FhirPublication; import org.hl7.fhir.r5.model.OperationOutcome; @@ -11,19 +8,22 @@ import org.hl7.fhir.r5.model.OperationOutcome.OperationOutcomeIssueComponent; import org.hl7.fhir.r5.test.utils.TestingUtilities; import org.hl7.fhir.validation.ValidationEngine; import org.hl7.fhir.validation.tests.utilities.TestUtilities; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.util.ArrayList; +import java.util.List; public class ValidationEngineTests { private static final String DEF_TX = "http://tx.fhir.org"; private static final String DBG_TX = "http://local.fhir.org:960"; - + public static boolean inbuild; @Test public void testCurrentXml() throws Exception { - if (!TestUtilities.silent) + if (!TestUtilities.silent) System.out.println("Validate patient-example.xml in Current version"); ValidationEngine ve = new ValidationEngine("hl7.fhir.r4.core#4.0.1", DEF_TX, null, FhirPublication.R4, "4.0.1"); OperationOutcome op = ve.validate(FhirFormat.XML, TestingUtilities.loadTestResourceStream("validator", "patient-example.xml"), null); @@ -31,36 +31,36 @@ public class ValidationEngineTests { int w = warnings(op); int h = hints(op); if (!TestUtilities.silent) { - System.out.println(" .. done: "+Integer.toString(e)+" errors, "+Integer.toString(w)+" warnings, "+Integer.toString(h)+" information messages"); + System.out.println(" .. done: " + Integer.toString(e) + " errors, " + Integer.toString(w) + " warnings, " + Integer.toString(h) + " information messages"); for (OperationOutcomeIssueComponent iss : op.getIssue()) { - System.out.println(" "+iss.getDetails().getText()); + System.out.println(" " + iss.getDetails().getText()); } } - Assert.assertTrue(e == 0); - Assert.assertTrue(w == 0); - Assert.assertTrue(h == 0); + Assertions.assertEquals(0, e); + Assertions.assertEquals(0, w); + Assertions.assertEquals(0, h); } @Test public void testCurrentJson() throws Exception { if (!TestUtilities.silent) - System.out.println("Validate patient-example.json in Current version"); + System.out.println("Validate patient-example.json in Current version"); ValidationEngine ve = new ValidationEngine("hl7.fhir.r4.core#4.0.1", DEF_TX, null, FhirPublication.R4, "4.0.1"); OperationOutcome op = ve.validate(FhirFormat.JSON, TestingUtilities.loadTestResourceStream("validator", "patient-example.json"), null); int e = errors(op); int w = warnings(op); int h = hints(op); - Assert.assertTrue(e == 0); - Assert.assertTrue(w == 0); - Assert.assertTrue(h == 0); + Assertions.assertEquals(0, e); + Assertions.assertEquals(0, w); + Assertions.assertEquals(0, h); if (!TestUtilities.silent) - System.out.println(" .. done: "+Integer.toString(e)+" errors, "+Integer.toString(w)+" warnings, "+Integer.toString(h)+" information messages"); + System.out.println(" .. done: " + Integer.toString(e) + " errors, " + Integer.toString(w) + " warnings, " + Integer.toString(h) + " information messages"); } @Test public void test140() throws Exception { if (inbuild) { - Assert.assertTrue(true); + Assertions.assertTrue(true); return; } if (!TestUtilities.silent) @@ -70,22 +70,22 @@ public class ValidationEngineTests { OperationOutcome op = ve.validate(FhirFormat.XML, TestingUtilities.loadTestResourceStream("validator", "patient140.xml"), null); if (!TestUtilities.silent) for (OperationOutcomeIssueComponent iss : op.getIssue()) { - System.out.println(" "+iss.getDetails().getText()); + System.out.println(" " + iss.getDetails().getText()); } int e = errors(op); int w = warnings(op); int h = hints(op); - Assert.assertTrue(e == 1); - Assert.assertTrue(w == 0); - Assert.assertTrue(h == 0); + Assertions.assertEquals(1, e); + Assertions.assertEquals(0, w); + Assertions.assertEquals(0, h); if (!TestUtilities.silent) - System.out.println(" .. done: "+Integer.toString(e)+" errors, "+Integer.toString(w)+" warnings, "+Integer.toString(h)+" information messages"); + System.out.println(" .. done: " + Integer.toString(e) + " errors, " + Integer.toString(w) + " warnings, " + Integer.toString(h) + " information messages"); } @Test public void test102() throws Exception { if (inbuild) { - Assert.assertTrue(true); + Assertions.assertTrue(true); return; } if (!org.hl7.fhir.validation.tests.utilities.TestUtilities.silent) @@ -95,22 +95,22 @@ public class ValidationEngineTests { OperationOutcome op = ve.validate(FhirFormat.XML, TestingUtilities.loadTestResourceStream("validator", "patient102.xml"), null); if (!TestUtilities.silent) for (OperationOutcomeIssueComponent iss : op.getIssue()) { - System.out.println(" "+iss.getSeverity().toCode()+": "+iss.getDetails().getText()); + System.out.println(" " + iss.getSeverity().toCode() + ": " + iss.getDetails().getText()); } int e = errors(op); int w = warnings(op); int h = hints(op); - Assert.assertTrue(e == 1); - Assert.assertTrue(w == 0); - Assert.assertTrue(h == 0); + Assertions.assertEquals(1, e); + Assertions.assertEquals(0, w); + Assertions.assertEquals(0, h); if (!TestUtilities.silent) - System.out.println(" .. done: "+Integer.toString(e)+" errors, "+Integer.toString(w)+" warnings, "+Integer.toString(h)+" information messages"); + System.out.println(" .. done: " + Integer.toString(e) + " errors, " + Integer.toString(w) + " warnings, " + Integer.toString(h) + " information messages"); } @Test public void testObs102() throws Exception { if (inbuild) { - Assert.assertTrue(true); + Assertions.assertTrue(true); return; } if (!TestUtilities.silent) @@ -120,16 +120,16 @@ public class ValidationEngineTests { OperationOutcome op = ve.validate(FhirFormat.JSON, TestingUtilities.loadTestResourceStream("validator", "observation102.json"), null); if (!TestUtilities.silent) for (OperationOutcomeIssueComponent iss : op.getIssue()) { - System.out.println(" "+iss.getDetails().getText()); + System.out.println(" " + iss.getDetails().getText()); } int e = errors(op); int w = warnings(op); int h = hints(op); - Assert.assertTrue(e == 1); - Assert.assertTrue(w == 0); - Assert.assertTrue(h == 1); + Assertions.assertEquals(1, e); + Assertions.assertEquals(0, w); + Assertions.assertEquals(1, h); if (!TestUtilities.silent) - System.out.println(" .. done: "+Integer.toString(e)+" errors, "+Integer.toString(w)+" warnings, "+Integer.toString(h)+" information messages"); + System.out.println(" .. done: " + Integer.toString(e) + " errors, " + Integer.toString(w) + " warnings, " + Integer.toString(h) + " information messages"); } @@ -143,13 +143,13 @@ public class ValidationEngineTests { OperationOutcome op = ve.validate(FhirFormat.XML, TestingUtilities.loadTestResourceStream("validator", "observation301.xml"), null); if (!TestUtilities.silent) for (OperationOutcomeIssueComponent issue : op.getIssue()) - System.out.println(" - "+issue.getDetails().getText()); + System.out.println(" - " + issue.getDetails().getText()); int e = errors(op); int w = warnings(op); int h = hints(op); - Assert.assertTrue(e == 0); + Assertions.assertEquals(0, e); if (!TestUtilities.silent) - System.out.println(" .. done: "+Integer.toString(e)+" errors, "+Integer.toString(w)+" warnings, "+Integer.toString(h)+" information messages"); + System.out.println(" .. done: " + Integer.toString(e) + " errors, " + Integer.toString(w) + " warnings, " + Integer.toString(h) + " information messages"); } @Test @@ -165,15 +165,15 @@ public class ValidationEngineTests { OperationOutcome op = ve.validate(FhirFormat.XML, TestingUtilities.loadTestResourceStream("validator", "patient301.xml"), profiles); if (!TestUtilities.silent) for (OperationOutcomeIssueComponent issue : op.getIssue()) - System.out.println(" - "+issue.getDetails().getText()); + System.out.println(" - " + issue.getDetails().getText()); int e = errors(op); int w = warnings(op); int h = hints(op); - Assert.assertTrue(e == 1); - Assert.assertTrue(w == 0); - Assert.assertTrue(h == 0); + Assertions.assertEquals(1, e); + Assertions.assertEquals(0, w); + Assertions.assertEquals(0, h); if (!TestUtilities.silent) - System.out.println(" .. done: "+Integer.toString(e)+" errors, "+Integer.toString(w)+" warnings, "+Integer.toString(h)+" information messages"); + System.out.println(" .. done: " + Integer.toString(e) + " errors, " + Integer.toString(w) + " warnings, " + Integer.toString(h) + " information messages"); } private int errors(OperationOutcome op) { diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTests.java similarity index 77% rename from org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java rename to org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTests.java index 05bc6ed7a..3811e1ace 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTestSuite.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/ValidationTests.java @@ -7,7 +7,10 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.NotImplementedException; -import org.hl7.fhir.convertors.*; +import org.hl7.fhir.convertors.VersionConvertor_10_50; +import org.hl7.fhir.convertors.VersionConvertor_14_50; +import org.hl7.fhir.convertors.VersionConvertor_30_50; +import org.hl7.fhir.convertors.VersionConvertor_40_50; import org.hl7.fhir.exceptions.DefinitionException; import org.hl7.fhir.exceptions.FHIRException; import org.hl7.fhir.exceptions.FHIRFormatError; @@ -19,40 +22,51 @@ import org.hl7.fhir.r5.elementmodel.Manager.FhirFormat; import org.hl7.fhir.r5.elementmodel.ObjectConverter; import org.hl7.fhir.r5.formats.JsonParser; import org.hl7.fhir.r5.formats.XmlParser; -import org.hl7.fhir.r5.model.*; +import org.hl7.fhir.r5.model.Base; +import org.hl7.fhir.r5.model.CanonicalResource; +import org.hl7.fhir.r5.model.Constants; +import org.hl7.fhir.r5.model.FhirPublication; +import org.hl7.fhir.r5.model.Patient; +import org.hl7.fhir.r5.model.Resource; +import org.hl7.fhir.r5.model.StructureDefinition; +import org.hl7.fhir.r5.model.TypeDetails; +import org.hl7.fhir.r5.model.ValueSet; import org.hl7.fhir.r5.test.utils.TestingUtilities; import org.hl7.fhir.r5.utils.FHIRPathEngine; import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext; import org.hl7.fhir.r5.utils.IResourceValidator; import org.hl7.fhir.r5.utils.IResourceValidator.IValidatorResourceFetcher; import org.hl7.fhir.r5.utils.IResourceValidator.ReferenceValidationPolicy; -import org.hl7.fhir.validation.instance.InstanceValidator; -import org.hl7.fhir.validation.ValidationEngine; import org.hl7.fhir.utilities.TextFile; import org.hl7.fhir.utilities.Utilities; import org.hl7.fhir.utilities.VersionUtilities; import org.hl7.fhir.utilities.validation.ValidationMessage; import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity; -import org.junit.AfterClass; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.junit.runners.Parameterized; -import org.junit.runners.Parameterized.Parameters; +import org.hl7.fhir.validation.ValidationEngine; +import org.hl7.fhir.validation.instance.InstanceValidator; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; import java.util.Map.Entry; +import java.util.stream.Stream; -@RunWith(Parameterized.class) -public class ValidationTestSuite implements IEvaluationContext, IValidatorResourceFetcher { +public class ValidationTests implements IEvaluationContext, IValidatorResourceFetcher { public final static boolean PRINT_OUTPUT_TO_CONSOLE = false; - - @Parameters(name = "{index}: id {0}") - public static Iterable data() throws IOException { + + public static Stream data() throws IOException { String contents = TestingUtilities.loadTestResource("validator", "manifest.json"); Map examples = new HashMap(); @@ -65,44 +79,37 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour names.addAll(examples.keySet()); Collections.sort(names); - List objects = new ArrayList(examples.size()); + List objects = new ArrayList<>(); for (String id : names) { - objects.add(new Object[] { id, examples.get(id)}); + objects.add(Arguments.of(id, examples.get(id))); } - return objects; + return objects.stream(); } private static JsonObject manifest; - - private String name; private JsonObject content; private String version; - - public ValidationTestSuite(String name, JsonObject content) { - this.name = name; - this.content = content; - } private static final String DEF_TX = "http://tx.fhir.org"; -// private static final String DEF_TX = "http://local.fhir.org:960"; private static Map ve = new HashMap<>(); private static ValidationEngine vCurr; - - @SuppressWarnings("deprecation") - @Test - public void test() throws Exception { - System.out.println("---- "+name+" ----------------------------------------------------------------"); + + @ParameterizedTest(name = "{index}: id {0}") + @MethodSource("data") + public void test(String name, JsonObject content) throws Exception { + this.content = content; + System.out.println("---- " + name + " ----------------------------------------------------------------"); System.out.println("** Core: "); String txLog = null; if (content.has("txLog")) { - txLog = content.get("txLog").getAsString(); + txLog = content.get("txLog").getAsString(); } version = "5.0"; List messages = new ArrayList(); if (content.has("version")) { version = content.get("version").getAsString(); } - + version = VersionUtilities.getMajMin(version); if (!ve.containsKey(version)) { if (version.startsWith("5.0")) @@ -116,7 +123,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour else if (version.startsWith("1.4")) ve.put(version, new ValidationEngine("hl7.fhir.r2b.core#1.4.0", DEF_TX, txLog, FhirPublication.DSTU2016May, true, "1.4.0")); else - throw new Exception("unknown version "+version); + throw new Exception("unknown version " + version); } vCurr = ve.get(version); vCurr.setFetcher(this); @@ -132,7 +139,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour InstanceValidator val = vCurr.getValidator(); val.setDebug(false); - if (content.has("allowed-extension-domain")) + if (content.has("allowed-extension-domain")) val.getExtensionDomains().add(content.get("allowed-extension-domain").getAsString()); if (content.has("allowed-extension-domains")) for (JsonElement a : content.getAsJsonArray("allowed-extension-domains")) @@ -149,7 +156,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour } if (content.has("supporting")) { for (JsonElement e : content.getAsJsonArray("supporting")) { - String filename = e.getAsString(); + String filename = e.getAsString(); String contents = TestingUtilities.loadTestResource("validator", filename); CanonicalResource mr = (CanonicalResource) loadResource(filename, contents); val.getContext().cacheResource(mr); @@ -172,7 +179,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour if (content.has("examples")) { val.setAllowExamples(content.get("examples").getAsBoolean()); } else { - val.setAllowExamples(true); + val.setAllowExamples(true); } val.setAssumeValidRestReferences(content.has("assumeValidRestReferences") ? content.get("assumeValidRestReferences").getAsBoolean() : false); if (name.endsWith(".json")) @@ -189,24 +196,24 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour } if (profile.has("supporting")) { for (JsonElement e : profile.getAsJsonArray("supporting")) { - String filename = e.getAsString(); + String filename = e.getAsString(); String contents = TestingUtilities.loadTestResource("validator", filename); CanonicalResource mr = (CanonicalResource) loadResource(filename, contents); val.getContext().cacheResource(mr); } } - String filename = profile.get("source").getAsString(); + String filename = profile.get("source").getAsString(); String contents = TestingUtilities.loadTestResource("validator", filename); - System.out.println("Name: " + name+" - profile : "+profile.get("source").getAsString()); + System.out.println("Name: " + name + " - profile : " + profile.get("source").getAsString()); version = content.has("version") ? content.get("version").getAsString() : Constants.VERSION; StructureDefinition sd = loadProfile(filename, contents, messages); - val.getContext().cacheResource(sd); + val.getContext().cacheResource(sd); val.setAssumeValidRestReferences(profile.has("assumeValidRestReferences") ? profile.get("assumeValidRestReferences").getAsBoolean() : false); List errorsProfile = new ArrayList(); if (name.endsWith(".json")) val.validate(null, errorsProfile, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.JSON, asSdList(sd)); else - val.validate(null, errorsProfile, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.XML, asSdList(sd)); + val.validate(null, errorsProfile, IOUtils.toInputStream(testCaseContent, Charsets.UTF_8), FhirFormat.XML, asSdList(sd)); System.out.println(val.reportTimes()); checkOutcomes(errorsProfile, profile); } @@ -214,7 +221,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour JsonObject logical = content.getAsJsonObject("logical"); if (logical.has("supporting")) { for (JsonElement e : logical.getAsJsonArray("supporting")) { - String filename = e.getAsString(); + String filename = e.getAsString(); String contents = TestingUtilities.loadTestResource("validator", filename); CanonicalResource mr = (CanonicalResource) loadResource(filename, contents); if (mr instanceof StructureDefinition) { @@ -229,7 +236,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour FHIRPathEngine fp = new FHIRPathEngine(val.getContext()); for (JsonElement e : logical.getAsJsonArray("expressions")) { String exp = e.getAsString(); - Assert.assertTrue(fp.evaluateToBoolean(null, le, le, le, fp.parse(exp))); + Assertions.assertTrue(fp.evaluateToBoolean(null, le, le, le, fp.parse(exp))); } } checkOutcomes(errorsLogical, logical); @@ -242,7 +249,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour return res; } - public StructureDefinition loadProfile(String filename, String contents, List messages) throws IOException, FHIRFormatError, FileNotFoundException, FHIRException, DefinitionException { + public StructureDefinition loadProfile(String filename, String contents, List messages) throws IOException, FHIRFormatError, FileNotFoundException, FHIRException, DefinitionException { StructureDefinition sd = (StructureDefinition) loadResource(filename, contents); ProfileUtilities pu = new ProfileUtilities(TestingUtilities.context(version), messages, null); if (!sd.hasSnapshot()) { @@ -250,19 +257,19 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour pu.generateSnapshot(base, sd, sd.getUrl(), null, sd.getTitle()); // (debugging) new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", sd.getId()+".xml")), sd); } - for (Resource r: sd.getContained()) { + for (Resource r : sd.getContained()) { if (r instanceof StructureDefinition) { - StructureDefinition childSd = (StructureDefinition)r; + StructureDefinition childSd = (StructureDefinition) r; if (!childSd.hasSnapshot()) { StructureDefinition base = TestingUtilities.context(version).fetchResource(StructureDefinition.class, childSd.getBaseDefinition()); - pu.generateSnapshot(base, childSd, childSd.getUrl(), null, childSd.getTitle()); + pu.generateSnapshot(base, childSd, childSd.getUrl(), null, childSd.getTitle()); } } } return sd; } - - public Resource loadResource(String filename, String contents) throws IOException, FHIRFormatError, FileNotFoundException, FHIRException, DefinitionException { + + public Resource loadResource(String filename, String contents) throws IOException, FHIRFormatError, FileNotFoundException, FHIRException, DefinitionException { try (InputStream inputStream = IOUtils.toInputStream(contents, Charsets.UTF_8)) { if (filename.contains(".json")) { if (Constants.VERSION.equals(version) || "5.0".equals(version)) @@ -276,7 +283,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour else if (org.hl7.fhir.r4.model.Constants.VERSION.equals(version) || "4.0".equals(version)) return VersionConvertor_40_50.convertResource(new org.hl7.fhir.r4.formats.JsonParser().parse(inputStream)); else - throw new FHIRException("unknown version "+version); + throw new FHIRException("unknown version " + version); } else { if (Constants.VERSION.equals(version) || "5.0".equals(version)) return new XmlParser().parse(inputStream); @@ -303,41 +310,41 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour for (ValidationMessage vm : errors) { if (vm.getLevel() == IssueSeverity.FATAL || vm.getLevel() == IssueSeverity.ERROR) { ec++; - if (PRINT_OUTPUT_TO_CONSOLE ) { + if (PRINT_OUTPUT_TO_CONSOLE) { System.out.println(vm.getDisplay()); } errLocs.add(vm.getLocation()); } - if (vm.getLevel() == IssueSeverity.WARNING) { + if (vm.getLevel() == IssueSeverity.WARNING) { wc++; - if (PRINT_OUTPUT_TO_CONSOLE ) { + if (PRINT_OUTPUT_TO_CONSOLE) { System.out.println(vm.getDisplay()); } } - if (vm.getLevel() == IssueSeverity.INFORMATION) { + if (vm.getLevel() == IssueSeverity.INFORMATION) { hc++; - if (PRINT_OUTPUT_TO_CONSOLE ) { + if (PRINT_OUTPUT_TO_CONSOLE) { System.out.println(vm.getDisplay()); } } } if (!TestingUtilities.context(version).isNoTerminologyServer() || !focus.has("tx-dependent")) { - Assert.assertEquals("Expected "+Integer.toString(java.get("errorCount").getAsInt())+" errors, but found "+Integer.toString(ec)+".", java.get("errorCount").getAsInt(), ec); + Assertions.assertEquals(java.get("errorCount").getAsInt(), ec, "Expected " + Integer.toString(java.get("errorCount").getAsInt()) + " errors, but found " + Integer.toString(ec) + "."); if (java.has("warningCount")) - Assert.assertEquals("Expected "+Integer.toString(java.get("warningCount").getAsInt())+" warnings, but found "+Integer.toString(wc)+".", java.get("warningCount").getAsInt(), wc); + Assertions.assertEquals(java.get("warningCount").getAsInt(), wc, "Expected " + Integer.toString(java.get("warningCount").getAsInt()) + " warnings, but found " + Integer.toString(wc) + "."); if (java.has("infoCount")) - Assert.assertEquals("Expected "+Integer.toString(java.get("infoCount").getAsInt())+" hints, but found "+Integer.toString(hc)+".", java.get("infoCount").getAsInt(), hc); + Assertions.assertEquals(java.get("infoCount").getAsInt(), hc, "Expected " + Integer.toString(java.get("infoCount").getAsInt()) + " hints, but found " + Integer.toString(hc) + "."); } if (java.has("error-locations")) { JsonArray el = java.getAsJsonArray("error-locations"); - Assert.assertEquals("locations count is not correct", errLocs.size(), el.size()); + Assertions.assertEquals(errLocs.size(), el.size(), "locations count is not correct"); for (int i = 0; i < errLocs.size(); i++) { - Assert.assertEquals("Location should be "+el.get(i).getAsString()+", but was "+errLocs.get(i), errLocs.get(i), el.get(i).getAsString()); + Assertions.assertEquals(errLocs.get(i), el.get(i).getAsString(), "Location should be " + el.get(i).getAsString() + ", but was " + errLocs.get(i)); } } if (focus.has("output")) { focus.remove("output"); - } + } JsonArray vr = new JsonArray(); java.add("output", vr); for (ValidationMessage vm : errors) { @@ -346,7 +353,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour } private org.hl7.fhir.r4.model.Parameters makeExpProfile() { - org.hl7.fhir.r4.model.Parameters ep = new org.hl7.fhir.r4.model.Parameters(); + org.hl7.fhir.r4.model.Parameters ep = new org.hl7.fhir.r4.model.Parameters(); ep.addParameter("profile-url", "http://hl7.org/fhir/ExpansionProfile/dc8fd4bc-091a-424a-8a3b-6198ef146891"); // change this to blow the cache // all defaults.... return ep; @@ -394,17 +401,17 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour Element res = null; if (url.equals("Patient/test")) { res = new ObjectConverter(TestingUtilities.context(version)).convert(new Patient()); - } else if (TestingUtilities.findTestResource("validator", url.replace("/", "-").toLowerCase()+".json")) { - res = Manager.makeParser(TestingUtilities.context(version), FhirFormat.JSON).parse(TestingUtilities.loadTestResourceStream("validator", url.replace("/", "-").toLowerCase()+".json")); - } else if (TestingUtilities.findTestResource("validator", url.replace("/", "-").toLowerCase()+".xml")) { - res = Manager.makeParser(TestingUtilities.context(version), FhirFormat.XML).parse(TestingUtilities.loadTestResourceStream("validator", url.replace("/", "-").toLowerCase()+".xml")); + } else if (TestingUtilities.findTestResource("validator", url.replace("/", "-").toLowerCase() + ".json")) { + res = Manager.makeParser(TestingUtilities.context(version), FhirFormat.JSON).parse(TestingUtilities.loadTestResourceStream("validator", url.replace("/", "-").toLowerCase() + ".json")); + } else if (TestingUtilities.findTestResource("validator", url.replace("/", "-").toLowerCase() + ".xml")) { + res = Manager.makeParser(TestingUtilities.context(version), FhirFormat.XML).parse(TestingUtilities.loadTestResourceStream("validator", url.replace("/", "-").toLowerCase() + ".xml")); } if (res == null && url.contains("/")) { - String tail = url.substring(url.indexOf("/")+1); - if (TestingUtilities.findTestResource("validator", tail.replace("/", "-").toLowerCase()+".json")) { - res = Manager.makeParser(TestingUtilities.context(version), FhirFormat.JSON).parse(TestingUtilities.loadTestResourceStream("validator", tail.replace("/", "-").toLowerCase()+".json")); - } else if (TestingUtilities.findTestResource("validator", tail.replace("/", "-").toLowerCase()+".xml")) { - res = Manager.makeParser(TestingUtilities.context(version), FhirFormat.XML).parse(TestingUtilities.loadTestResourceStream("validator", tail.replace("/", "-").toLowerCase()+".xml")); + String tail = url.substring(url.indexOf("/") + 1); + if (TestingUtilities.findTestResource("validator", tail.replace("/", "-").toLowerCase() + ".json")) { + res = Manager.makeParser(TestingUtilities.context(version), FhirFormat.JSON).parse(TestingUtilities.loadTestResourceStream("validator", tail.replace("/", "-").toLowerCase() + ".json")); + } else if (TestingUtilities.findTestResource("validator", tail.replace("/", "-").toLowerCase() + ".xml")) { + res = Manager.makeParser(TestingUtilities.context(version), FhirFormat.XML).parse(TestingUtilities.loadTestResourceStream("validator", tail.replace("/", "-").toLowerCase() + ".xml")); } } return res; @@ -425,7 +432,7 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour @Override public void setLocale(Locale locale) { - //do nothing + //do nothing } @Override @@ -447,10 +454,10 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour return vCurr.getContext().fetchResource(ValueSet.class, url); } - @AfterClass + @AfterAll public static void saveWhenDone() throws IOException { String content = new GsonBuilder().setPrettyPrinting().create().toJson(manifest); TextFile.stringToFile(content, Utilities.path("[tmp]", "validator-produced-manifest.json")); - + } } diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/utilities/TestUtilities.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/utilities/TestUtilities.java index 889c23d3a..849952531 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/utilities/TestUtilities.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/tests/utilities/TestUtilities.java @@ -1,14 +1,5 @@ package org.hl7.fhir.validation.tests.utilities; -import java.io.IOException; -import java.io.InputStream; - -import org.apache.commons.io.IOUtils; -import org.hl7.fhir.utilities.Utilities; -import org.hl7.fhir.validation.tests.ValidationTestSuite; - -import com.google.common.base.Charsets; - public class TestUtilities { public static boolean silent = false; @@ -17,5 +8,4 @@ public class TestUtilities { // return org.hl7.fhir.utilities.Utilities.path(System.getProperty("user.dir"), "src", "test", "resources", name); // } - } diff --git a/pom.xml b/pom.xml index bf84fb376..01c4dc00d 100644 --- a/pom.xml +++ b/pom.xml @@ -19,6 +19,7 @@ 4.2.0 1.1.10-SNAPSHOT 5.6.2 + 3.0.0-M4 org.hl7.fhir.core @@ -71,25 +72,6 @@ test - - - org.junit.jupiter - junit-jupiter-api - ${junit_jupiter_version} - test - - - org.junit.jupiter - junit-jupiter-params - ${junit_jupiter_version} - test - - - org.junit.vintage - junit-vintage-engine - ${junit_jupiter_version} - test - @@ -174,24 +156,13 @@ maven-surefire-plugin + ${maven_surefire_version} false false -Xmx4096m false - - - org.junit.jupiter - junit-jupiter-engine - ${junit_jupiter_version} - - - org.junit.vintage - junit-vintage-engine - ${junit_jupiter_version} - - org.basepom.maven