From 3005c9a7667fdfa8dc1a3366e361f4f74fe33626 Mon Sep 17 00:00:00 2001 From: jamesagnew Date: Tue, 15 Dec 2015 09:11:01 -0500 Subject: [PATCH] Still working on unit tests --- .../src/main/java/ca/uhn/fhir/parser/ParserState.java | 8 +++----- .../resources/ca/uhn/fhir/narrative/narratives.properties | 3 --- .../test/java/ca/uhn/fhir/parser/XmlParserDstu21Test.java | 3 +++ .../DefaultThymeleafNarrativeGeneratorTestDstu2.java | 2 ++ .../test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java | 4 ++++ .../ca/uhn/fhir/rest/client/GenericClientDstu2Test.java | 2 +- hapi-fhir-structures-hl7org-dstu2/pom.xml | 2 +- .../java/ca/uhn/fhir/parser/XmlParserHl7OrgDstu2Test.java | 6 ++++-- 8 files changed, 18 insertions(+), 12 deletions(-) diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java index 4dc0b6ba053..d4445b09910 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/parser/ParserState.java @@ -1732,11 +1732,9 @@ class ParserState { public void enteringNewElement(String theNamespaceUri, String theLocalPart) throws DataFormatException { BaseRuntimeElementDefinition target = myContext.getRuntimeChildUndeclaredExtensionDefinition().getChildByName(theLocalPart); if (target == null) { - //FIXME: fix this - throw new DataFormatException("Unknown " + theLocalPart + " - Valid names are: " + new TreeSet(myContext.getRuntimeChildUndeclaredExtensionDefinition().getValidChildNames())); -// myErrorHandler.unknownElement(null, theLocalPart); -// push(new SwallowChildrenWholeState(getPreResourceState())); -// return; + myErrorHandler.unknownElement(null, theLocalPart); + push(new SwallowChildrenWholeState(getPreResourceState())); + return; } switch (target.getChildType()) { diff --git a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/narrative/narratives.properties b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/narrative/narratives.properties index 13cf6b32f7e..7c720eeea08 100644 --- a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/narrative/narratives.properties +++ b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/narrative/narratives.properties @@ -67,9 +67,6 @@ patient.title=classpath:ca/uhn/fhir/narrative/title/Patient.html medicationprescription.class=ca.uhn.fhir.model.dstu.resource.MedicationPrescription medicationprescription.narrative=classpath:ca/uhn/fhir/narrative/MedicationPrescription.html medicationprescription.title=classpath:ca/uhn/fhir/narrative/title/MedicationPrescription.html -medicationorder.class=ca.uhn.fhir.model.dstu2.resource.MedicationOrder -medicationorder.narrative=classpath:ca/uhn/fhir/narrative/MedicationPrescription.html -medicationorder.title=classpath:ca/uhn/fhir/narrative/title/MedicationPrescription.html medication.class=ca.uhn.fhir.model.dstu.resource.Medication medication.narrative=classpath:ca/uhn/fhir/narrative/Medication.html diff --git a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/XmlParserDstu21Test.java b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/XmlParserDstu21Test.java index 4c22561ba96..2980a023bd2 100644 --- a/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/XmlParserDstu21Test.java +++ b/hapi-fhir-structures-dstu2.1/src/test/java/ca/uhn/fhir/parser/XmlParserDstu21Test.java @@ -520,8 +520,11 @@ public class XmlParserDstu21Test { /** * Test for #233 + * + * This was rolled back after a conversation with grahame */ @Test + @Ignore public void testEncodeAndParseProfiledDatatype() { MedicationOrder mo = new MedicationOrder(); mo.addDosageInstruction().getTiming().getRepeat().setBounds(new DurationDt().setCode("code")); diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorTestDstu2.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorTestDstu2.java index 5417f9b0e41..e978ace5a8c 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorTestDstu2.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/narrative/DefaultThymeleafNarrativeGeneratorTestDstu2.java @@ -9,6 +9,7 @@ import java.util.Date; import org.hamcrest.core.StringContains; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import ca.uhn.fhir.context.FhirContext; @@ -195,6 +196,7 @@ public class DefaultThymeleafNarrativeGeneratorTestDstu2 { } @Test + @Ignore public void testGenerateMedicationPrescription() { MedicationOrder mp = new MedicationOrder(); mp.setId("12345"); diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java index d59dd49af22..20f9803b44a 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserDstu2Test.java @@ -32,6 +32,7 @@ import org.hamcrest.core.StringContains; import org.hamcrest.text.StringContainsInOrder; import org.hl7.fhir.instance.model.api.IBaseResource; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import org.mockito.ArgumentCaptor; @@ -581,8 +582,11 @@ public class XmlParserDstu2Test { /** * See #216 - Profiled datatypes should use their unprofiled parent type as the choice[x] name + * + * Disabled because we reverted this change after a conversation with Grahame */ @Test + @Ignore public void testEncodeAndParseProfiledDatatypeChoice() throws Exception { IParser xmlParser = ourCtx.newXmlParser(); diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Test.java index 9a106f8d5aa..fd9383f26f0 100644 --- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Test.java +++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/GenericClientDstu2Test.java @@ -1143,7 +1143,7 @@ public class GenericClientDstu2Test { assertEquals("http://example.com/fhir/Patient/1/$validate-code", capt.getAllValues().get(idx).getURI().toASCIIString()); ourLog.info(extractBody(capt, idx)); - assertEquals("",extractBody(capt, idx)); + assertEquals("",extractBody(capt, idx)); } diff --git a/hapi-fhir-structures-hl7org-dstu2/pom.xml b/hapi-fhir-structures-hl7org-dstu2/pom.xml index 02ca6fc4f6f..fddc434d616 100644 --- a/hapi-fhir-structures-hl7org-dstu2/pom.xml +++ b/hapi-fhir-structures-hl7org-dstu2/pom.xml @@ -182,7 +182,7 @@ maven-surefire-plugin 2.19 - false + true random -Dfile.encoding=UTF-8 false diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserHl7OrgDstu2Test.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserHl7OrgDstu2Test.java index 89a36a392d4..755e8e6cd6a 100644 --- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserHl7OrgDstu2Test.java +++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/parser/XmlParserHl7OrgDstu2Test.java @@ -26,7 +26,6 @@ import org.hamcrest.core.IsNot; import org.hamcrest.core.StringContains; import org.hamcrest.text.StringContainsInOrder; import org.hl7.fhir.instance.model.Address; -import org.hl7.fhir.instance.model.Attachment; import org.hl7.fhir.instance.model.Address.AddressUse; import org.hl7.fhir.instance.model.Address.AddressUseEnumFactory; import org.hl7.fhir.instance.model.Binary; @@ -49,7 +48,6 @@ import org.hl7.fhir.instance.model.Identifier.IdentifierUse; import org.hl7.fhir.instance.model.InstantType; import org.hl7.fhir.instance.model.MedicationStatement; import org.hl7.fhir.instance.model.Narrative.NarrativeStatus; -import org.hl7.fhir.instance.model.annotations.Child; import org.hl7.fhir.instance.model.Observation; import org.hl7.fhir.instance.model.Organization; import org.hl7.fhir.instance.model.Patient; @@ -62,6 +60,7 @@ import org.hl7.fhir.instance.model.StringType; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IPrimitiveType; import org.junit.BeforeClass; +import org.junit.Ignore; import org.junit.Test; import org.xml.sax.SAXException; @@ -91,8 +90,11 @@ public class XmlParserHl7OrgDstu2Test { /** * See #216 - Profiled datatypes should use their unprofiled parent type as the choice[x] name + * + * Disabled after conversation with Grahame */ @Test + @Ignore public void testEncodeAndParseProfiledDatatypeChoice() throws Exception { IParser xmlParser = ourCtx.newXmlParser();