You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by gn...@apache.org on 2020/06/11 07:52:12 UTC
[camel] 02/11: [CAMEL-11807] Upgrade camel-fhir to junit5
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
commit 3fe1be45ffde717ca77d706a3213571b3f5dc0b5
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Thu Jun 11 07:40:44 2020 +0200
[CAMEL-11807] Upgrade camel-fhir to junit5
---
components/camel-fhir/camel-fhir-component/pom.xml | 8 ++---
.../component/fhir/AbstractFhirTestSupport.java | 14 ++++-----
.../camel/component/fhir/FhirCapabilitiesIT.java | 9 ++++--
.../camel/component/fhir/FhirConfigurationIT.java | 4 ++-
.../apache/camel/component/fhir/FhirCreateIT.java | 11 ++++---
.../fhir/FhirCustomClientConfigurationIT.java | 4 ++-
.../apache/camel/component/fhir/FhirDeleteIT.java | 16 ++++++----
.../component/fhir/FhirExtraParametersIT.java | 7 +++--
.../apache/camel/component/fhir/FhirHistoryIT.java | 13 +++++----
.../camel/component/fhir/FhirLoadPageIT.java | 17 ++++++-----
.../apache/camel/component/fhir/FhirMetaIT.java | 17 ++++++-----
.../camel/component/fhir/FhirOperationIT.java | 23 ++++++++-------
.../apache/camel/component/fhir/FhirPatchIT.java | 13 +++++----
.../apache/camel/component/fhir/FhirReadIT.java | 7 +++--
.../apache/camel/component/fhir/FhirSearchIT.java | 7 +++--
.../camel/component/fhir/FhirTransactionIT.java | 13 +++++----
.../apache/camel/component/fhir/FhirUpdateIT.java | 34 ++++++++++++----------
.../camel/component/fhir/FhirValidateIT.java | 9 ++++--
.../Hl7v2PatientToFhirPatientIntegrationTest.java | 7 +++--
.../camel/component/fhir/UrlFetcherTest.java | 6 ++--
.../fhir/dataformat/FhirJsonDataFormatTest.java | 14 +++++----
.../FhirJsonDataformatErrorHandlerTest.java | 17 +++++++----
.../fhir/dataformat/FhirXmlDataFormatTest.java | 14 +++++----
.../FhirXmlDataformatErrorHandlerTest.java | 18 +++++++-----
.../spring/FhirDataformatConfigSpringTest.java | 12 +++++---
.../FhirDataformatDefaultConfigSpringTest.java | 12 +++++---
.../spring/FhirJsonDataFormatSpringTest.java | 14 +++++----
.../FhirJsonDataformatErrorHandlerSpringTest.java | 20 ++++++++-----
.../spring/FhirXmlDataFormatSpringTest.java | 14 +++++----
.../FhirXmlDataformatErrorHandlerSpringTest.java | 19 +++++++-----
30 files changed, 238 insertions(+), 155 deletions(-)
diff --git a/components/camel-fhir/camel-fhir-component/pom.xml b/components/camel-fhir/camel-fhir-component/pom.xml
index dcfd40c..6d2d3df 100644
--- a/components/camel-fhir/camel-fhir-component/pom.xml
+++ b/components/camel-fhir/camel-fhir-component/pom.xml
@@ -103,20 +103,20 @@
<!-- testing -->
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
+ <artifactId>camel-test-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test-spring</artifactId>
+ <artifactId>camel-test-spring-junit5</artifactId>
<scope>test</scope>
</dependency>
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/AbstractFhirTestSupport.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/AbstractFhirTestSupport.java
index a42fdd3..aefd640 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/AbstractFhirTestSupport.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/AbstractFhirTestSupport.java
@@ -28,15 +28,17 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException;
import org.apache.camel.CamelContext;
import org.apache.camel.CamelExecutionException;
import org.apache.camel.support.PropertyBindingSupport;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.HumanName;
import org.hl7.fhir.dstu3.model.Patient;
-import org.junit.Before;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestInstance;
/**
* Abstract base class for Fhir Integration tests generated by Camel API component maven plugin.
*/
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public abstract class AbstractFhirTestSupport extends CamelTestSupport {
private static final String TEST_OPTIONS_PROPERTIES = "/test-options.properties";
@@ -46,7 +48,7 @@ public abstract class AbstractFhirTestSupport extends CamelTestSupport {
FhirContext fhirContext;
IGenericClient fhirClient;
- @Before
+ @BeforeEach
public void cleanFhirServerState() {
if (patientExists()) {
deletePatient();
@@ -115,12 +117,6 @@ public abstract class AbstractFhirTestSupport extends CamelTestSupport {
this.fhirClient = GENERIC_CLIENT_THREAD_LOCAL.get();
}
- @Override
- public boolean isCreateCamelContextPerClass() {
- // only create the context once for this class
- return true;
- }
-
@SuppressWarnings("unchecked")
<T> T requestBodyAndHeaders(String endpointUri, Object body, Map<String, Object> headers)
throws CamelExecutionException {
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirCapabilitiesIT.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirCapabilitiesIT.java
index 8dec20c..27a4011 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirCapabilitiesIT.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirCapabilitiesIT.java
@@ -25,10 +25,13 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirCapabilitiesApiMethod;
import org.hl7.fhir.dstu3.model.CapabilityStatement;
import org.hl7.fhir.dstu3.model.Enumerations;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
/**
* Test class for {@link org.apache.camel.component.fhir.api.FhirCapabilities} APIs.
* The class source won't be generated again if the generator MOJO finds it under src/test/java.
@@ -43,7 +46,7 @@ public class FhirCapabilitiesIT extends AbstractFhirTestSupport {
org.hl7.fhir.instance.model.api.IBaseConformance result = requestBody("direct://OF_TYPE", CapabilityStatement.class);
LOG.debug("ofType: " + result);
- assertNotNull("ofType result", result);
+ assertNotNull(result, "ofType result");
assertEquals(Enumerations.PublicationStatus.ACTIVE, ((CapabilityStatement)result).getStatus());
}
@@ -55,7 +58,7 @@ public class FhirCapabilitiesIT extends AbstractFhirTestSupport {
org.hl7.fhir.instance.model.api.IBaseConformance result = requestBodyAndHeaders("direct://OF_TYPE", CapabilityStatement.class, headers);
LOG.debug("ofType: " + result);
- assertNotNull("ofType result", result);
+ assertNotNull(result, "ofType result");
assertEquals(Enumerations.PublicationStatus.ACTIVE, ((CapabilityStatement)result).getStatus());
}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirConfigurationIT.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirConfigurationIT.java
index 7388522..f2eb086 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirConfigurationIT.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirConfigurationIT.java
@@ -26,7 +26,9 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirCreateApiMethod;
import org.apache.camel.impl.DefaultCamelContext;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Test class for {@link FhirConfiguration} APIs.
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirCreateIT.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirCreateIT.java
index 4dcda5d..8046ea2 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirCreateIT.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirCreateIT.java
@@ -26,10 +26,13 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirCreateApiMethod;
import org.hl7.fhir.dstu3.model.HumanName;
import org.hl7.fhir.dstu3.model.Patient;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
/**
* Test class for {@link org.apache.camel.component.fhir.api.FhirCreate} APIs.
* The class source won't be generated again if the generator MOJO finds it under src/test/java.
@@ -46,7 +49,7 @@ public class FhirCreateIT extends AbstractFhirTestSupport {
MethodOutcome result = requestBody("direct://RESOURCE", patient);
LOG.debug("resource: " + result);
- assertNotNull("resource result", result);
+ assertNotNull(result, "resource result");
assertTrue(result.getCreated());
}
@@ -58,7 +61,7 @@ public class FhirCreateIT extends AbstractFhirTestSupport {
MethodOutcome result = requestBody("direct://RESOURCE_STRING", patientString);
LOG.debug("resource: " + result);
- assertNotNull("resource result", result);
+ assertNotNull(result, "resource result");
assertTrue(result.getCreated());
}
@@ -71,7 +74,7 @@ public class FhirCreateIT extends AbstractFhirTestSupport {
MethodOutcome result = requestBodyAndHeaders("direct://RESOURCE_STRING", patientString, headers);
LOG.debug("resource: " + result);
- assertNotNull("resource result", result);
+ assertNotNull(result, "resource result");
assertTrue(result.getCreated());
}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirCustomClientConfigurationIT.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirCustomClientConfigurationIT.java
index 5214566..076dc34 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirCustomClientConfigurationIT.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirCustomClientConfigurationIT.java
@@ -55,7 +55,9 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirCreateApiMethod;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.instance.model.api.IBaseResource;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Test class for {@link FhirConfiguration} APIs.
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirDeleteIT.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirDeleteIT.java
index 310e138..9b3ff2e 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirDeleteIT.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirDeleteIT.java
@@ -25,10 +25,14 @@ import org.apache.camel.component.fhir.api.ExtraParameters;
import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirDeleteApiMethod;
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
/**
* Test class for {@link org.apache.camel.component.fhir.api.FhirDelete} APIs.
* The class source won't be generated again if the generator MOJO finds it under src/test/java.
@@ -45,7 +49,7 @@ public class FhirDeleteIT extends AbstractFhirTestSupport {
IBaseOperationOutcome result = requestBody("direct://RESOURCE", this.patient);
LOG.debug("resource: " + result);
- assertNotNull("resource result", result);
+ assertNotNull(result, "resource result");
assertFalse(patientExists());
}
@@ -57,7 +61,7 @@ public class FhirDeleteIT extends AbstractFhirTestSupport {
IBaseOperationOutcome result = requestBody("direct://RESOURCE_BY_ID", this.patient.getIdElement());
LOG.debug("resourceById: " + result);
- assertNotNull("resourceById result", result);
+ assertNotNull(result, "resourceById result");
assertFalse(patientExists());
}
@@ -74,7 +78,7 @@ public class FhirDeleteIT extends AbstractFhirTestSupport {
IBaseOperationOutcome result = requestBodyAndHeaders("direct://RESOURCE_BY_STRING_ID", null, headers);
LOG.debug("resourceById: " + result);
- assertNotNull("resourceById result", result);
+ assertNotNull(result, "resourceById result");
assertFalse(patientExists());
}
@@ -85,7 +89,7 @@ public class FhirDeleteIT extends AbstractFhirTestSupport {
IBaseOperationOutcome result = requestBody("direct://RESOURCE_CONDITIONAL_BY_URL", "Patient?given=Vincent&family=Freeman");
LOG.debug("resourceConditionalByUrl: " + result);
- assertNotNull("resourceConditionalByUrl result", result);
+ assertNotNull(result, "resourceConditionalByUrl result");
assertFalse(patientExists());
}
@@ -98,7 +102,7 @@ public class FhirDeleteIT extends AbstractFhirTestSupport {
IBaseOperationOutcome result = requestBodyAndHeaders("direct://RESOURCE_CONDITIONAL_BY_URL", "Patient?given=Vincent&family=Freeman", headers);
LOG.debug("resourceConditionalByUrl: " + result);
- assertNotNull("resourceConditionalByUrl result", result);
+ assertNotNull(result, "resourceConditionalByUrl result");
assertFalse(patientExists());
}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirExtraParametersIT.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirExtraParametersIT.java
index 5f1e88b..40ffed1 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirExtraParametersIT.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirExtraParametersIT.java
@@ -25,10 +25,13 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirSearchApiMethod;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Patient;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
/**
* Test class for {@link org.apache.camel.component.fhir.api.FhirSearch} APIs.
* The class source won't be generated again if the generator MOJO finds it under src/test/java.
@@ -48,7 +51,7 @@ public class FhirExtraParametersIT extends AbstractFhirTestSupport {
Bundle result = requestBodyAndHeaders("direct://SEARCH_BY_URL", url, headers);
LOG.debug("searchByUrl: " + result);
- assertNotNull("searchByUrl result", result);
+ assertNotNull(result, "searchByUrl result");
Patient patient = (Patient) result.getEntry().get(0).getResource();
assertNotNull(patient);
assertEquals("Freeman", patient.getName().get(0).getFamily());
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirHistoryIT.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirHistoryIT.java
index 1705fa5..f6dc638 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirHistoryIT.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirHistoryIT.java
@@ -25,10 +25,13 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirHistoryApiMethod;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Patient;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
/**
* Test class for {@link org.apache.camel.component.fhir.api.FhirHistory} APIs.
* The class source won't be generated again if the generator MOJO finds it under src/test/java.
@@ -50,7 +53,7 @@ public class FhirHistoryIT extends AbstractFhirTestSupport {
Bundle result = requestBodyAndHeaders("direct://ON_INSTANCE", null, headers);
LOG.debug("onInstance: " + result);
- assertNotNull("onInstance result", result);
+ assertNotNull(result, "onInstance result");
assertEquals(1, result.getEntry().size());
}
@@ -62,7 +65,7 @@ public class FhirHistoryIT extends AbstractFhirTestSupport {
Bundle result = requestBodyAndHeaders("direct://ON_SERVER", null, headers);
LOG.debug("onServer: " + result);
- assertNotNull("onServer result", result);
+ assertNotNull(result, "onServer result");
assertEquals(1, result.getEntry().size());
}
@@ -79,7 +82,7 @@ public class FhirHistoryIT extends AbstractFhirTestSupport {
Bundle result = requestBodyAndHeaders("direct://ON_TYPE", null, headers);
LOG.debug("onType: " + result);
- assertNotNull("onType result", result);
+ assertNotNull(result, "onType result");
assertEquals(1, result.getEntry().size());
}
@@ -99,7 +102,7 @@ public class FhirHistoryIT extends AbstractFhirTestSupport {
Bundle result = requestBodyAndHeaders("direct://ON_TYPE", null, headers);
LOG.debug("onType: " + result);
- assertNotNull("onType result", result);
+ assertNotNull(result, "onType result");
assertEquals(1, result.getEntry().size());
}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirLoadPageIT.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirLoadPageIT.java
index e775340..46d0075 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirLoadPageIT.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirLoadPageIT.java
@@ -31,11 +31,14 @@ import org.hl7.fhir.dstu3.model.HumanName;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseBundle;
import org.hl7.fhir.instance.model.api.IBaseResource;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
/**
* Test class for {@link org.apache.camel.component.fhir.api.FhirLoadPage} APIs.
* The class source won't be generated again if the generator MOJO finds it under src/test/java.
@@ -64,7 +67,7 @@ public class FhirLoadPageIT extends AbstractFhirTestSupport {
IBaseBundle result = requestBodyAndHeaders("direct://BY_URL", null, headers);
LOG.debug("byUrl: " + result);
- assertNotNull("byUrl result", result);
+ assertNotNull(result, "byUrl result");
}
@Test
@@ -78,7 +81,7 @@ public class FhirLoadPageIT extends AbstractFhirTestSupport {
// using org.hl7.fhir.instance.model.api.IBaseBundle message body for single parameter "bundle"
Bundle result = requestBody("direct://NEXT", bundle);
- assertNotNull("next result", result);
+ assertNotNull(result, "next result");
LOG.debug("next: " + result);
}
@@ -98,7 +101,7 @@ public class FhirLoadPageIT extends AbstractFhirTestSupport {
Bundle result = requestBody("direct://PREVIOUS", bundle);
LOG.debug("previous: " + result);
- assertNotNull("previous result", result);
+ assertNotNull(result, "previous result");
}
@Test
@@ -119,10 +122,10 @@ public class FhirLoadPageIT extends AbstractFhirTestSupport {
Bundle result = requestBodyAndHeaders("direct://PREVIOUS", bundle, headers);
LOG.debug("previous: " + result);
- assertNotNull("previous result", result);
+ assertNotNull(result, "previous result");
}
- @Before
+ @BeforeEach
public void populateServer() {
List<IBaseResource> input = new ArrayList<>();
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirMetaIT.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirMetaIT.java
index 2c21e88..866769c 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirMetaIT.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirMetaIT.java
@@ -26,10 +26,13 @@ import org.apache.camel.component.fhir.internal.FhirMetaApiMethod;
import org.hl7.fhir.dstu3.model.Meta;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseMetaType;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
/**
* Test class for {@link org.apache.camel.component.fhir.api.FhirMeta} APIs.
* The class source won't be generated again if the generator MOJO finds it under src/test/java.
@@ -55,7 +58,7 @@ public class FhirMetaIT extends AbstractFhirTestSupport {
IBaseMetaType result = requestBodyAndHeaders("direct://ADD", null, headers);
LOG.debug("add: " + result);
- assertNotNull("add result", result);
+ assertNotNull(result, "add result");
assertEquals(1, result.getTag().size());
}
@@ -84,7 +87,7 @@ public class FhirMetaIT extends AbstractFhirTestSupport {
IBaseMetaType result = requestBodyAndHeaders("direct://DELETE", null, headers);
LOG.debug("delete: " + result);
- assertNotNull("delete result", result);
+ assertNotNull(result, "delete result");
assertEquals(0, result.getTag().size());
}
@@ -99,7 +102,7 @@ public class FhirMetaIT extends AbstractFhirTestSupport {
IBaseMetaType result = requestBodyAndHeaders("direct://GET_FROM_RESOURCE", null, headers);
LOG.debug("getFromResource: " + result);
- assertNotNull("getFromResource result", result);
+ assertNotNull(result, "getFromResource result");
assertEquals(0, result.getTag().size());
}
@@ -107,7 +110,7 @@ public class FhirMetaIT extends AbstractFhirTestSupport {
public void testGetFromServer() throws Exception {
// using Class message body for single parameter "metaType"
IBaseMetaType result = requestBody("direct://GET_FROM_SERVER", Meta.class);
- assertNotNull("getFromServer result", result);
+ assertNotNull(result, "getFromServer result");
LOG.debug("getFromServer: " + result);
}
@@ -122,7 +125,7 @@ public class FhirMetaIT extends AbstractFhirTestSupport {
IBaseMetaType result = requestBodyAndHeaders("direct://GET_FROM_TYPE", null, headers);
LOG.debug("getFromType: " + result);
- assertNotNull("getFromType result", result);
+ assertNotNull(result, "getFromType result");
}
@Test
@@ -137,7 +140,7 @@ public class FhirMetaIT extends AbstractFhirTestSupport {
Meta result = requestBodyAndHeaders("direct://GET_FROM_TYPE", null, headers);
LOG.debug("getFromType: " + result);
- assertNotNull("getFromType result", result);
+ assertNotNull(result, "getFromType result");
}
@Override
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirOperationIT.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirOperationIT.java
index d33ea3b..9f3a89a 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirOperationIT.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirOperationIT.java
@@ -26,11 +26,14 @@ import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.dstu3.model.Parameters;
import org.hl7.fhir.dstu3.model.Patient;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
/**
* Test class for {@link org.apache.camel.component.fhir.api.FhirOperation} APIs.
*/
@@ -59,9 +62,9 @@ public class FhirOperationIT extends AbstractFhirTestSupport {
final Parameters result = requestBodyAndHeaders("direct://ON_INSTANCE", null, headers);
LOG.debug("onInstance: " + result);
- assertNotNull("onInstance result", result);
+ assertNotNull(result, "onInstance result");
Bundle bundle = (Bundle) result.getParameter().get(0).getResource();
- assertNotNull("onInstance result", bundle);
+ assertNotNull(bundle, "onInstance result");
IdType id = bundle.getEntry().get(0).getResource().getIdElement().toUnqualifiedVersionless();
assertEquals(patient.getIdElement().toUnqualifiedVersionless(), id);
}
@@ -86,9 +89,9 @@ public class FhirOperationIT extends AbstractFhirTestSupport {
final Parameters result = requestBodyAndHeaders("direct://ON_INSTANCE_VERSION", null, headers);
LOG.debug("onInstance: " + result);
- assertNotNull("onInstance result", result);
+ assertNotNull(result, "onInstance result");
Bundle bundle = (Bundle) result.getParameter().get(0).getResource();
- assertNotNull("onInstance result", bundle);
+ assertNotNull(bundle, "onInstance result");
IdType id = bundle.getEntry().get(0).getResource().getIdElement().toUnqualifiedVersionless();
assertEquals(patient.getIdElement().toUnqualifiedVersionless(), id);
}
@@ -109,7 +112,7 @@ public class FhirOperationIT extends AbstractFhirTestSupport {
headers.put("CamelFhir.extraParameters", null);
final Parameters result = requestBodyAndHeaders("direct://ON_SERVER", null, headers);
- assertNotNull("onServer result", result);
+ assertNotNull(result, "onServer result");
}
@Test
@@ -131,11 +134,11 @@ public class FhirOperationIT extends AbstractFhirTestSupport {
final org.hl7.fhir.instance.model.api.IBaseResource result = requestBodyAndHeaders("direct://ON_TYPE", null, headers);
- assertNotNull("onType result", result);
+ assertNotNull(result, "onType result");
LOG.debug("onType: " + result);
}
- @Ignore("Not implemented yet in HAPI FHIR server side, see"
+ @Disabled("Not implemented yet in HAPI FHIR server side, see"
+ " https://github.com/jamesagnew/hapi-fhir/blob/master/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/dstu3/FhirResourceDaoMessageHeaderDstu3.java#L33")
@Test
public void testProcessMessage() throws Exception {
@@ -152,7 +155,7 @@ public class FhirOperationIT extends AbstractFhirTestSupport {
final org.hl7.fhir.instance.model.api.IBaseBundle result = requestBodyAndHeaders("direct://PROCESS_MESSAGE", null, headers);
- assertNotNull("processMessage result", result);
+ assertNotNull(result, "processMessage result");
LOG.debug("processMessage: " + result);
}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirPatchIT.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirPatchIT.java
index c3a6015..aa19e2e 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirPatchIT.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirPatchIT.java
@@ -29,11 +29,14 @@ import org.apache.camel.component.fhir.internal.FhirPatchApiMethod;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseResource;
import org.hl7.fhir.instance.model.api.IIdType;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
/**
* Test class for {@link org.apache.camel.component.fhir.api.FhirPatch} APIs.
* The class source won't be generated again if the generator MOJO finds it under src/test/java.
@@ -55,7 +58,7 @@ public class FhirPatchIT extends AbstractFhirTestSupport {
headers.put("CamelFhir.preferReturn", null);
MethodOutcome result = requestBodyAndHeaders("direct://PATCH_BY_ID", null, headers);
- assertNotNull("patchById result", result);
+ assertNotNull(result, "patchById result");
assertActive(result);
}
@@ -92,7 +95,7 @@ public class FhirPatchIT extends AbstractFhirTestSupport {
}
@Test
- @Ignore(value = "https://github.com/jamesagnew/hapi-fhir/issues/955")
+ @Disabled(value = "https://github.com/jamesagnew/hapi-fhir/issues/955")
public void testPatchByUrl() throws Exception {
final Map<String, Object> headers = new HashMap<>();
// parameter type is String
@@ -104,7 +107,7 @@ public class FhirPatchIT extends AbstractFhirTestSupport {
MethodOutcome result = requestBodyAndHeaders("direct://PATCH_BY_URL", null, headers);
- assertNotNull("patchByUrl result", result);
+ assertNotNull(result, "patchByUrl result");
LOG.debug("patchByUrl: " + result);
assertActive(result);
}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirReadIT.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirReadIT.java
index 93bce78..39d2770 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirReadIT.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirReadIT.java
@@ -25,10 +25,13 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirReadApiMethod;
import org.hl7.fhir.dstu3.model.IdType;
import org.hl7.fhir.dstu3.model.Patient;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
/**
* Test class for {@link org.apache.camel.component.fhir.api.FhirRead} APIs.
* The class source won't be generated again if the generator MOJO finds it under src/test/java.
@@ -214,7 +217,7 @@ public class FhirReadIT extends AbstractFhirTestSupport {
private void assertValidResponse(Patient result) {
LOG.debug("response: " + result);
- assertNotNull("resourceByUrl result", result);
+ assertNotNull(result, "resourceByUrl result");
assertEquals("Freeman", result.getName().get(0).getFamily());
}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirSearchIT.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirSearchIT.java
index 34ab9ba..8532b45 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirSearchIT.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirSearchIT.java
@@ -21,10 +21,13 @@ import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirSearchApiMethod;
import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.Patient;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
/**
* Test class for {@link org.apache.camel.component.fhir.api.FhirSearch} APIs.
* The class source won't be generated again if the generator MOJO finds it under src/test/java.
@@ -40,7 +43,7 @@ public class FhirSearchIT extends AbstractFhirTestSupport {
Bundle result = requestBody("direct://SEARCH_BY_URL", url);
LOG.debug("searchByUrl: " + result);
- assertNotNull("searchByUrl result", result);
+ assertNotNull(result, "searchByUrl result");
Patient patient = (Patient) result.getEntry().get(0).getResource();
assertNotNull(patient);
assertEquals("Freeman", patient.getName().get(0).getFamily());
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirTransactionIT.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirTransactionIT.java
index b49d9b5..9e1a670 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirTransactionIT.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirTransactionIT.java
@@ -30,10 +30,13 @@ import org.hl7.fhir.dstu3.model.Bundle;
import org.hl7.fhir.dstu3.model.HumanName;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseResource;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
/**
* Test class for {@link org.apache.camel.component.fhir.api.FhirTransaction} APIs.
* The class source won't be generated again if the generator MOJO finds it under src/test/java.
@@ -48,7 +51,7 @@ public class FhirTransactionIT extends AbstractFhirTestSupport {
// using org.hl7.fhir.instance.model.api.IBaseBundle message body for single parameter "bundle"
Bundle result = requestBody("direct://WITH_BUNDLE", createTransactionBundle());
- assertNotNull("withBundle result", result);
+ assertNotNull(result, "withBundle result");
assertTrue(result.getEntry().get(0).getResponse().getStatus().contains("Created"));
LOG.debug("withBundle: " + result);
}
@@ -61,7 +64,7 @@ public class FhirTransactionIT extends AbstractFhirTestSupport {
// using String message body for single parameter "sBundle"
final String result = requestBody("direct://WITH_STRING_BUNDLE", stringBundle);
- assertNotNull("withBundle result", result);
+ assertNotNull(result, "withBundle result");
assertTrue(result.contains("Bundle"));
LOG.debug("withBundle: " + result);
}
@@ -77,7 +80,7 @@ public class FhirTransactionIT extends AbstractFhirTestSupport {
// using java.util.List message body for single parameter "resources"
List<IBaseResource> result = requestBody("direct://WITH_RESOURCES", patients);
- assertNotNull("withResources result", result);
+ assertNotNull(result, "withResources result");
LOG.debug("withResources: " + result);
assertTrue(result.size() == 2);
}
@@ -95,7 +98,7 @@ public class FhirTransactionIT extends AbstractFhirTestSupport {
// using java.util.List message body for single parameter "resources"
List<IBaseResource> result = requestBodyAndHeaders("direct://WITH_RESOURCES", patients, headers);
- assertNotNull("withResources result", result);
+ assertNotNull(result, "withResources result");
LOG.debug("withResources: " + result);
assertTrue(result.size() == 2);
}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirUpdateIT.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirUpdateIT.java
index dc5aed5..deea670 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirUpdateIT.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirUpdateIT.java
@@ -28,10 +28,14 @@ import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.fhir.internal.FhirApiCollection;
import org.apache.camel.component.fhir.internal.FhirUpdateApiMethod;
import org.hl7.fhir.dstu3.model.Patient;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+
/**
* Test class for {@link org.apache.camel.component.fhir.api.FhirUpdate} APIs.
* The class source won't be generated again if the generator MOJO finds it under src/test/java.
@@ -56,9 +60,9 @@ public class FhirUpdateIT extends AbstractFhirTestSupport {
MethodOutcome result = requestBodyAndHeaders("direct://RESOURCE", null, headers);
- assertNotNull("resource result", result);
+ assertNotNull(result, "resource result");
LOG.debug("resource: " + result);
- assertEquals("Birth date not updated!", date, ((Patient)result.getResource()).getBirthDate());
+ assertEquals(date, ((Patient)result.getResource()).getBirthDate(), "Birth date not updated!");
}
@Test
@@ -74,9 +78,9 @@ public class FhirUpdateIT extends AbstractFhirTestSupport {
MethodOutcome result = requestBodyAndHeaders("direct://RESOURCE", null, headers);
- assertNotNull("resource result", result);
+ assertNotNull(result, "resource result");
LOG.debug("resource: " + result);
- assertEquals("Birth date not updated!", date, ((Patient)result.getResource()).getBirthDate());
+ assertEquals(date, ((Patient)result.getResource()).getBirthDate(), "Birth date not updated!");
}
@Test
@@ -94,9 +98,9 @@ public class FhirUpdateIT extends AbstractFhirTestSupport {
MethodOutcome result = requestBodyAndHeaders("direct://RESOURCE_WITH_STRING_ID", null, headers);
- assertNotNull("resource result", result);
+ assertNotNull(result, "resource result");
LOG.debug("resource: " + result);
- assertEquals("Birth date not updated!", date, ((Patient)result.getResource()).getBirthDate());
+ assertEquals(date, ((Patient)result.getResource()).getBirthDate(), "Birth date not updated!");
}
@Test
@@ -114,9 +118,9 @@ public class FhirUpdateIT extends AbstractFhirTestSupport {
MethodOutcome result = requestBodyAndHeaders("direct://RESOURCE_AS_STRING", null, headers);
- assertNotNull("resource result", result);
+ assertNotNull(result, "resource result");
LOG.debug("resource: " + result);
- assertEquals("Birth date not updated!", date, ((Patient)result.getResource()).getBirthDate());
+ assertEquals(date, ((Patient)result.getResource()).getBirthDate(), "Birth date not updated!");
}
@Test
@@ -134,9 +138,9 @@ public class FhirUpdateIT extends AbstractFhirTestSupport {
MethodOutcome result = requestBodyAndHeaders("direct://RESOURCE_AS_STRING_WITH_STRING_ID", null, headers);
- assertNotNull("resource result", result);
+ assertNotNull(result, "resource result");
LOG.debug("resource: " + result);
- assertEquals("Birth date not updated!", date, ((Patient)result.getResource()).getBirthDate());
+ assertEquals(date, ((Patient)result.getResource()).getBirthDate(), "Birth date not updated!");
}
@Test
@@ -155,9 +159,9 @@ public class FhirUpdateIT extends AbstractFhirTestSupport {
MethodOutcome result = requestBodyAndHeaders("direct://RESOURCE_BY_SEARCH_URL", null, headers);
- assertNotNull("resource result", result);
+ assertNotNull(result, "resource result");
LOG.debug("resource: " + result);
- assertEquals("Birth date not updated!", date, ((Patient)result.getResource()).getBirthDate());
+ assertEquals(date, ((Patient)result.getResource()).getBirthDate(), "Birth date not updated!");
}
@Test
@@ -176,9 +180,9 @@ public class FhirUpdateIT extends AbstractFhirTestSupport {
MethodOutcome result = requestBodyAndHeaders("direct://RESOURCE_BY_SEARCH_URL_AND_RESOURCE_AS_STRING", null, headers);
- assertNotNull("resource result", result);
+ assertNotNull(result, "resource result");
LOG.debug("resource: " + result);
- assertEquals("Birth date not updated!", date, ((Patient)result.getResource()).getBirthDate());
+ assertEquals(date, ((Patient)result.getResource()).getBirthDate(), "Birth date not updated!");
}
@Override
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirValidateIT.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirValidateIT.java
index f1537ac..fd63b8b 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirValidateIT.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/FhirValidateIT.java
@@ -23,10 +23,13 @@ import org.apache.camel.component.fhir.internal.FhirValidateApiMethod;
import org.hl7.fhir.dstu3.model.HumanName;
import org.hl7.fhir.dstu3.model.OperationOutcome;
import org.hl7.fhir.dstu3.model.Patient;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
/**
* Test class for {@link org.apache.camel.component.fhir.api.FhirValidate} APIs.
* The class source won't be generated again if the generator MOJO finds it under src/test/java.
@@ -42,7 +45,7 @@ public class FhirValidateIT extends AbstractFhirTestSupport {
// using org.hl7.fhir.instance.model.api.IBaseResource message body for single parameter "resource"
MethodOutcome result = requestBody("direct://RESOURCE", bobbyHebb);
- assertNotNull("resource result", result);
+ assertNotNull(result, "resource result");
LOG.debug("resource: " + result);
assertNotNull(result.getOperationOutcome());
assertTrue(((OperationOutcome) result.getOperationOutcome()).getText().getDivAsString().contains("No issues detected during validation"));
@@ -54,7 +57,7 @@ public class FhirValidateIT extends AbstractFhirTestSupport {
// using org.hl7.fhir.instance.model.api.IBaseResource message body for single parameter "resource"
MethodOutcome result = requestBody("direct://RESOURCE_AS_STRING", this.fhirContext.newXmlParser().encodeResourceToString(bobbyHebb));
- assertNotNull("resource result", result);
+ assertNotNull(result, "resource result");
LOG.debug("resource: " + result);
assertNotNull(result.getOperationOutcome());
assertTrue(((OperationOutcome) result.getOperationOutcome()).getText().getDivAsString().contains("No issues detected during validation"));
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/Hl7v2PatientToFhirPatientIntegrationTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/Hl7v2PatientToFhirPatientIntegrationTest.java
index f3a8549..0f7a176 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/Hl7v2PatientToFhirPatientIntegrationTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/Hl7v2PatientToFhirPatientIntegrationTest.java
@@ -24,7 +24,10 @@ import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* This test demonstrates how to convert a HL7V2 patient to a FHIR dtsu3 Patient and then insert it into a FHIR server.
@@ -68,7 +71,7 @@ public class Hl7v2PatientToFhirPatientIntegrationTest extends AbstractFhirTestSu
mock.assertIsSatisfied();
MethodOutcome result = mock.getExchanges().get(0).getIn().getBody(MethodOutcome.class);
- assertNotNull("resource result", result);
+ assertNotNull(result, "resource result");
assertTrue(result.getCreated());
}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/UrlFetcherTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/UrlFetcherTest.java
index 15dfa6d..bad6b14 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/UrlFetcherTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/UrlFetcherTest.java
@@ -20,10 +20,10 @@ import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.rest.client.api.IGenericClient;
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
import org.hl7.fhir.dstu3.model.Patient;
-import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
-@Ignore("Helper class to generate search URLs based on HAPI-FHIR's search API")
+@Disabled("Helper class to generate search URLs based on HAPI-FHIR's search API")
public class UrlFetcherTest {
@Test
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataFormatTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataFormatTest.java
index 55d10e9..1c9c499 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataFormatTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataFormatTest.java
@@ -23,14 +23,16 @@ import ca.uhn.fhir.context.FhirContext;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
import org.hl7.fhir.dstu3.model.Address;
import org.hl7.fhir.dstu3.model.Base;
import org.hl7.fhir.dstu3.model.HumanName;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseResource;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FhirJsonDataFormatTest extends CamelTestSupport {
@@ -41,7 +43,7 @@ public class FhirJsonDataFormatTest extends CamelTestSupport {
private MockEndpoint mockEndpoint;
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
mockEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
@@ -57,7 +59,7 @@ public class FhirJsonDataFormatTest extends CamelTestSupport {
Exchange exchange = mockEndpoint.getExchanges().get(0);
Patient patient = (Patient) exchange.getIn().getBody();
- assertTrue("Patients should be equal!", patient.equalsDeep(getPatient()));
+ assertTrue(patient.equalsDeep(getPatient()), "Patients should be equal!");
}
@Test
@@ -72,7 +74,7 @@ public class FhirJsonDataFormatTest extends CamelTestSupport {
Exchange exchange = mockEndpoint.getExchanges().get(0);
InputStream inputStream = exchange.getIn().getBody(InputStream.class);
IBaseResource iBaseResource = FhirContext.forDstu3().newJsonParser().parseResource(new InputStreamReader(inputStream));
- assertTrue("Patients should be equal!", patient.equalsDeep((Base) iBaseResource));
+ assertTrue(patient.equalsDeep((Base) iBaseResource), "Patients should be equal!");
}
private Patient getPatient() {
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataformatErrorHandlerTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataformatErrorHandlerTest.java
index 65a2a52..31583d6 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataformatErrorHandlerTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirJsonDataformatErrorHandlerTest.java
@@ -26,10 +26,14 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.fhir.FhirJsonDataFormat;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
import org.hl7.fhir.dstu3.model.Patient;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
public class FhirJsonDataformatErrorHandlerTest extends CamelTestSupport {
@@ -39,18 +43,19 @@ public class FhirJsonDataformatErrorHandlerTest extends CamelTestSupport {
private final FhirContext fhirContext = FhirContext.forDstu3();
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
mockEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
}
- @Test(expected = DataFormatException.class)
+ @Test
public void unmarshalParserErrorHandler() throws Throwable {
try {
template.sendBody("direct:unmarshalErrorHandlerStrict", INPUT);
+ fail("Expected a DataFormatException");
} catch (CamelExecutionException e) {
- throw e.getCause();
+ assertTrue(e.getCause() instanceof DataFormatException);
}
}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataFormatTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataFormatTest.java
index 6e91c91..7643169 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataFormatTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataFormatTest.java
@@ -23,14 +23,16 @@ import ca.uhn.fhir.context.FhirContext;
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
import org.hl7.fhir.dstu3.model.Address;
import org.hl7.fhir.dstu3.model.Base;
import org.hl7.fhir.dstu3.model.HumanName;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseResource;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class FhirXmlDataFormatTest extends CamelTestSupport {
@@ -42,7 +44,7 @@ public class FhirXmlDataFormatTest extends CamelTestSupport {
private MockEndpoint mockEndpoint;
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
mockEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
@@ -58,7 +60,7 @@ public class FhirXmlDataFormatTest extends CamelTestSupport {
Exchange exchange = mockEndpoint.getExchanges().get(0);
Patient patient = (Patient) exchange.getIn().getBody();
- assertTrue("Patients should be equal!", patient.equalsDeep(getPatient()));
+ assertTrue(patient.equalsDeep(getPatient()), "Patients should be equal!");
}
@Test
@@ -73,7 +75,7 @@ public class FhirXmlDataFormatTest extends CamelTestSupport {
Exchange exchange = mockEndpoint.getExchanges().get(0);
InputStream inputStream = exchange.getIn().getBody(InputStream.class);
final IBaseResource iBaseResource = FhirContext.forDstu3().newXmlParser().parseResource(new InputStreamReader(inputStream));
- assertTrue("Patients should be equal!", patient.equalsDeep((Base) iBaseResource));
+ assertTrue(patient.equalsDeep((Base) iBaseResource), "Patients should be equal!");
}
private Patient getPatient() {
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataformatErrorHandlerTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataformatErrorHandlerTest.java
index 4856e91..8e60b25 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataformatErrorHandlerTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/FhirXmlDataformatErrorHandlerTest.java
@@ -26,10 +26,13 @@ import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.fhir.FhirXmlDataFormat;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
+import org.apache.camel.test.junit5.CamelTestSupport;
import org.hl7.fhir.dstu3.model.Patient;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
public class FhirXmlDataformatErrorHandlerTest extends CamelTestSupport {
@@ -39,18 +42,19 @@ public class FhirXmlDataformatErrorHandlerTest extends CamelTestSupport {
private final FhirContext fhirContext = FhirContext.forDstu3();
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
mockEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
}
- @Test(expected = DataFormatException.class)
+ @Test
public void unmarshalParserErrorHandler() throws Throwable {
try {
template.sendBody("direct:unmarshalErrorHandlerStrict", INPUT);
+ fail("Expected a DataFormatException");
} catch (CamelExecutionException e) {
- throw e.getCause();
+ assertTrue(e.getCause() instanceof DataFormatException);
}
}
@@ -64,7 +68,7 @@ public class FhirXmlDataformatErrorHandlerTest extends CamelTestSupport {
Exchange exchange = mockEndpoint.getExchanges().get(0);
Patient patient = (Patient) exchange.getIn().getBody();
- assertEquals(true, patient.getActive());
+ assertTrue(patient.getActive());
}
@Override
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirDataformatConfigSpringTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirDataformatConfigSpringTest.java
index ee45ce6..395dfb2 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirDataformatConfigSpringTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirDataformatConfigSpringTest.java
@@ -26,17 +26,21 @@ import ca.uhn.fhir.parser.LenientErrorHandler;
import org.apache.camel.CamelContext;
import org.apache.camel.component.fhir.FhirDataFormat;
import org.apache.camel.reifier.dataformat.DataFormatReifier;
-import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.apache.camel.test.spring.junit5.CamelSpringTestSupport;
import org.hl7.fhir.dstu3.model.IdType;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
public class FhirDataformatConfigSpringTest extends CamelSpringTestSupport {
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirDataformatDefaultConfigSpringTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirDataformatDefaultConfigSpringTest.java
index 8f9ff1a..0f32587 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirDataformatDefaultConfigSpringTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirDataformatDefaultConfigSpringTest.java
@@ -19,16 +19,20 @@ package org.apache.camel.component.fhir.dataformat.spring;
import ca.uhn.fhir.context.FhirVersionEnum;
import org.apache.camel.CamelContext;
import org.apache.camel.component.fhir.FhirDataFormat;
-import org.apache.camel.test.spring.CamelSpringTestSupport;
-import org.junit.Before;
-import org.junit.Test;
+import org.apache.camel.test.spring.junit5.CamelSpringTestSupport;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNull;
+
public class FhirDataformatDefaultConfigSpringTest extends CamelSpringTestSupport {
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirJsonDataFormatSpringTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirJsonDataFormatSpringTest.java
index 6bfbdeb..d7766e5 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirJsonDataFormatSpringTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirJsonDataFormatSpringTest.java
@@ -22,17 +22,19 @@ import java.io.InputStreamReader;
import ca.uhn.fhir.context.FhirContext;
import org.apache.camel.Exchange;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.apache.camel.test.spring.junit5.CamelSpringTestSupport;
import org.hl7.fhir.dstu3.model.Address;
import org.hl7.fhir.dstu3.model.Base;
import org.hl7.fhir.dstu3.model.HumanName;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseResource;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
public class FhirJsonDataFormatSpringTest extends CamelSpringTestSupport {
private static final String PATIENT = "{\"resourceType\":\"Patient\","
@@ -42,7 +44,7 @@ public class FhirJsonDataFormatSpringTest extends CamelSpringTestSupport {
private MockEndpoint mockEndpoint;
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
mockEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
@@ -58,7 +60,7 @@ public class FhirJsonDataFormatSpringTest extends CamelSpringTestSupport {
Exchange exchange = mockEndpoint.getExchanges().get(0);
Patient patient = (Patient) exchange.getIn().getBody();
- assertTrue("Patients should be equal!", patient.equalsDeep(getPatient()));
+ assertTrue(patient.equalsDeep(getPatient()), "Patients should be equal!");
}
@Test
@@ -73,7 +75,7 @@ public class FhirJsonDataFormatSpringTest extends CamelSpringTestSupport {
Exchange exchange = mockEndpoint.getExchanges().get(0);
InputStream inputStream = exchange.getIn().getBody(InputStream.class);
IBaseResource iBaseResource = FhirContext.forDstu3().newJsonParser().parseResource(new InputStreamReader(inputStream));
- assertTrue("Patients should be equal!", patient.equalsDeep((Base) iBaseResource));
+ assertTrue(patient.equalsDeep((Base) iBaseResource), "Patients should be equal!");
}
private Patient getPatient() {
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirJsonDataformatErrorHandlerSpringTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirJsonDataformatErrorHandlerSpringTest.java
index a1ef8b3..0726f1f 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirJsonDataformatErrorHandlerSpringTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirJsonDataformatErrorHandlerSpringTest.java
@@ -20,31 +20,37 @@ import ca.uhn.fhir.parser.DataFormatException;
import org.apache.camel.CamelExecutionException;
import org.apache.camel.Exchange;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.apache.camel.test.spring.junit5.CamelSpringTestSupport;
import org.hl7.fhir.dstu3.model.Patient;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
public class FhirJsonDataformatErrorHandlerSpringTest extends CamelSpringTestSupport {
private static final String INPUT = "{\"resourceType\":\"Patient\",\"extension\":[ {\"valueDateTime\":\"2011-01-02T11:13:15\"} ]}";
private MockEndpoint mockEndpoint;
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
mockEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
}
- @Test(expected = DataFormatException.class)
+ @Test
public void unmarshalParserErrorHandler() throws Throwable {
try {
template.sendBody("direct:unmarshalErrorHandlerStrict", INPUT);
+ fail("Expected a DataFormatException");
} catch (CamelExecutionException e) {
- throw e.getCause();
+ assertTrue(e.getCause() instanceof DataFormatException);
}
}
@@ -59,7 +65,7 @@ public class FhirJsonDataformatErrorHandlerSpringTest extends CamelSpringTestSup
Exchange exchange = mockEndpoint.getExchanges().get(0);
Patient patient = (Patient) exchange.getIn().getBody();
assertEquals(1, patient.getExtension().size());
- assertEquals(null, patient.getExtension().get(0).getUrl());
+ assertNull(patient.getExtension().get(0).getUrl());
assertEquals("2011-01-02T11:13:15", patient.getExtension().get(0).getValueAsPrimitive().getValueAsString());
}
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirXmlDataFormatSpringTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirXmlDataFormatSpringTest.java
index 99e46af..d761f8b 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirXmlDataFormatSpringTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirXmlDataFormatSpringTest.java
@@ -22,17 +22,19 @@ import java.io.InputStreamReader;
import ca.uhn.fhir.context.FhirContext;
import org.apache.camel.Exchange;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.apache.camel.test.spring.junit5.CamelSpringTestSupport;
import org.hl7.fhir.dstu3.model.Address;
import org.hl7.fhir.dstu3.model.Base;
import org.hl7.fhir.dstu3.model.HumanName;
import org.hl7.fhir.dstu3.model.Patient;
import org.hl7.fhir.instance.model.api.IBaseResource;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
public class FhirXmlDataFormatSpringTest extends CamelSpringTestSupport {
private static final String PATIENT =
@@ -44,7 +46,7 @@ public class FhirXmlDataFormatSpringTest extends CamelSpringTestSupport {
private MockEndpoint mockEndpoint;
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
mockEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
@@ -60,7 +62,7 @@ public class FhirXmlDataFormatSpringTest extends CamelSpringTestSupport {
Exchange exchange = mockEndpoint.getExchanges().get(0);
Patient patient = (Patient) exchange.getIn().getBody();
- assertTrue("Patients should be equal!", patient.equalsDeep(getPatient()));
+ assertTrue(patient.equalsDeep(getPatient()), "Patients should be equal!");
}
@Test
@@ -75,7 +77,7 @@ public class FhirXmlDataFormatSpringTest extends CamelSpringTestSupport {
Exchange exchange = mockEndpoint.getExchanges().get(0);
InputStream inputStream = exchange.getIn().getBody(InputStream.class);
final IBaseResource iBaseResource = FhirContext.forDstu3().newXmlParser().parseResource(new InputStreamReader(inputStream));
- assertTrue("Patients should be equal!", patient.equalsDeep((Base) iBaseResource));
+ assertTrue(patient.equalsDeep((Base) iBaseResource), "Patients should be equal!");
}
private Patient getPatient() {
diff --git a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirXmlDataformatErrorHandlerSpringTest.java b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirXmlDataformatErrorHandlerSpringTest.java
index aa593ca..c3a4181 100644
--- a/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirXmlDataformatErrorHandlerSpringTest.java
+++ b/components/camel-fhir/camel-fhir-component/src/test/java/org/apache/camel/component/fhir/dataformat/spring/FhirXmlDataformatErrorHandlerSpringTest.java
@@ -20,13 +20,17 @@ import ca.uhn.fhir.parser.DataFormatException;
import org.apache.camel.CamelExecutionException;
import org.apache.camel.Exchange;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.spring.CamelSpringTestSupport;
+import org.apache.camel.test.spring.junit5.CamelSpringTestSupport;
import org.hl7.fhir.dstu3.model.Patient;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
+import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
+
public class FhirXmlDataformatErrorHandlerSpringTest extends CamelSpringTestSupport {
private static final String INPUT = "<Patient><active value=\"true\"/><active value=\"false\"/></Patient>";
@@ -34,18 +38,19 @@ public class FhirXmlDataformatErrorHandlerSpringTest extends CamelSpringTestSupp
private MockEndpoint mockEndpoint;
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
mockEndpoint = resolveMandatoryEndpoint("mock:result", MockEndpoint.class);
}
- @Test(expected = DataFormatException.class)
+ @Test
public void unmarshalParserErrorHandler() throws Throwable {
try {
template.sendBody("direct:unmarshalErrorHandlerStrict", INPUT);
+ fail("Expected a DataFormatException");
} catch (CamelExecutionException e) {
- throw e.getCause();
+ assertTrue(e.getCause() instanceof DataFormatException);
}
}
@@ -59,7 +64,7 @@ public class FhirXmlDataformatErrorHandlerSpringTest extends CamelSpringTestSupp
Exchange exchange = mockEndpoint.getExchanges().get(0);
Patient patient = (Patient) exchange.getIn().getBody();
- assertEquals(true, patient.getActive());
+ assertTrue(patient.getActive());
}
@Override