This is an automated email from the ASF dual-hosted git repository. aldettinger pushed a commit to branch CAMEL-13826 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 29c5e52d49d60d3571a1f38e41c9de62a02166d9 Author: aldettinger <aldettin...@gmail.com> AuthorDate: Wed Aug 21 17:31:13 2019 +0200 CAMEL-13826: Migrated half of the camel-xstream tests to JUnit 5 (testing coexistence of JUnit 4 and JUnit 5) --- components/camel-test/pom.xml | 4 ++++ components/camel-xstream/pom.xml | 5 +++++ .../dataformat/xstream/MarshalDomainObjectJSONTest.java | 4 +++- .../camel/dataformat/xstream/MarshalDomainObjectTest.java | 8 +++++--- .../xstream/XStreamDataFormatOmitFieldsTest.java | 15 +++++++++------ .../XStreamDataFormatPermissionsSystemPropertyTest.java | 13 ++++++++----- .../xstream/XStreamDataFormatPermissionsTest.java | 7 +++++-- parent/pom.xml | 4 ++-- .../camel-spring-boot-dependencies-generator/pom.xml | 1 + 9 files changed, 42 insertions(+), 19 deletions(-) diff --git a/components/camel-test/pom.xml b/components/camel-test/pom.xml index 2e70437..aa6acfa 100644 --- a/components/camel-test/pom.xml +++ b/components/camel-test/pom.xml @@ -54,6 +54,10 @@ <groupId>junit</groupId> <artifactId>junit</artifactId> </dependency> + <dependency> + <groupId>org.junit.vintage</groupId> + <artifactId>junit-vintage-engine</artifactId> + </dependency> <dependency> <groupId>org.apache.logging.log4j</groupId> diff --git a/components/camel-xstream/pom.xml b/components/camel-xstream/pom.xml index d3fa5d7..99dad32 100644 --- a/components/camel-xstream/pom.xml +++ b/components/camel-xstream/pom.xml @@ -77,6 +77,11 @@ </dependency> <dependency> <groupId>org.apache.camel</groupId> + <artifactId>camel-test-junit5</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.camel</groupId> <artifactId>camel-spring</artifactId> <scope>test</scope> </dependency> diff --git a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectJSONTest.java b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectJSONTest.java index 6f6ad86..2e6fe37 100644 --- a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectJSONTest.java +++ b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectJSONTest.java @@ -19,7 +19,9 @@ package org.apache.camel.dataformat.xstream; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.model.dataformat.JsonLibrary; -import org.junit.Test; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; public class MarshalDomainObjectJSONTest extends MarshalDomainObjectTest { diff --git a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectTest.java b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectTest.java index 8e429d5..2096c85 100644 --- a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectTest.java +++ b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/MarshalDomainObjectTest.java @@ -18,8 +18,10 @@ package org.apache.camel.dataformat.xstream; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Test; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; /** * Marshal tests with domain objects. @@ -58,7 +60,7 @@ public class MarshalDomainObjectTest extends CamelTestSupport { String body1 = mock.getExchanges().get(0).getIn().getBody(String.class); String body2 = mock.getExchanges().get(1).getIn().getBody(String.class); - assertEquals("The body should marshalled to the same", body1, body2); + assertEquals(body1, body2, "The body should marshalled to the same"); } @Test diff --git a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamDataFormatOmitFieldsTest.java b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamDataFormatOmitFieldsTest.java index b6d34e2..b9df598 100644 --- a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamDataFormatOmitFieldsTest.java +++ b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamDataFormatOmitFieldsTest.java @@ -21,8 +21,11 @@ import java.util.Map; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Test; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; public class XStreamDataFormatOmitFieldsTest extends CamelTestSupport { @@ -40,10 +43,10 @@ public class XStreamDataFormatOmitFieldsTest extends CamelTestSupport { assertMockEndpointsSatisfied(); - String body = mock.getReceivedExchanges().get(0).getIn().getBody(String.class); - assertTrue("Should contain name field", body.contains("<name>")); - assertFalse("Should not contain price field", body.contains("price")); - assertTrue("Should contain amount field", body.contains("<amount>")); + String body = mock.getReceivedExchanges().get(0).getIn().getBody(String.class); + assertTrue(body.contains("<name>"), "Should contain name field"); + assertFalse(body.contains("price"), "Should not contain price field"); + assertTrue(body.contains("<amount>"), "Should contain amount field"); } diff --git a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamDataFormatPermissionsSystemPropertyTest.java b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamDataFormatPermissionsSystemPropertyTest.java index 99f83d6..acf39a4 100644 --- a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamDataFormatPermissionsSystemPropertyTest.java +++ b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamDataFormatPermissionsSystemPropertyTest.java @@ -16,20 +16,23 @@ */ package org.apache.camel.dataformat.xstream; import com.thoughtworks.xstream.XStream; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.junit.Test; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotNull; public class XStreamDataFormatPermissionsSystemPropertyTest extends XStreamDataFormatPermissionsTest { - @BeforeClass + @BeforeAll public static void setup() { // clear the default permissions system property // see AbstractXStreamWrapper.PERMISSIONS_PROPERTY_DEFAULT XStreamTestUtils.setPermissionSystemProperty("*"); } - @AfterClass + @AfterAll public static void cleanup() { XStreamTestUtils.revertPermissionSystemProperty(); } diff --git a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamDataFormatPermissionsTest.java b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamDataFormatPermissionsTest.java index 425be60..ee8a274 100644 --- a/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamDataFormatPermissionsTest.java +++ b/components/camel-xstream/src/test/java/org/apache/camel/dataformat/xstream/XStreamDataFormatPermissionsTest.java @@ -18,8 +18,11 @@ package org.apache.camel.dataformat.xstream; import com.thoughtworks.xstream.XStream; import com.thoughtworks.xstream.security.ForbiddenClassException; -import org.apache.camel.test.junit4.CamelTestSupport; -import org.junit.Test; +import org.apache.camel.test.junit5.CamelTestSupport; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.fail; public class XStreamDataFormatPermissionsTest extends CamelTestSupport { protected static final String XML_PURCHASE_ORDER = diff --git a/parent/pom.xml b/parent/pom.xml index 9bf50b0..3c84977 100644 --- a/parent/pom.xml +++ b/parent/pom.xml @@ -4794,8 +4794,8 @@ <version>${junit-jupiter-version}</version> </dependency> <dependency> - <groupId>org.junit.jupiter</groupId> - <artifactId>junit-jupiter-vintage</artifactId> + <groupId>org.junit.vintage</groupId> + <artifactId>junit-vintage-engine</artifactId> <version>${junit-jupiter-version}</version> </dependency> <dependency> diff --git a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies-generator/pom.xml b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies-generator/pom.xml index 38b5af6..9e5cc33 100644 --- a/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies-generator/pom.xml +++ b/platforms/spring-boot/spring-boot-dm/camel-spring-boot-dependencies-generator/pom.xml @@ -160,6 +160,7 @@ <exclude>javax.servlet:javax.servlet-api</exclude> <exclude>junit:*</exclude> <exclude>org.junit.jupiter:*</exclude> + <exclude>org.junit.vintage:*</exclude> <exclude>net.sf.ehcache:ehcache</exclude> <exclude>xml-apis:*</exclude>