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/07/18 11:38:01 UTC
[camel] 08/11: [CAMEL-11807] Upgrade camel-pg-replication-slot 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 6144fb18d6caed2ae303b500bf6ca468c482a703
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Fri Jul 17 16:05:21 2020 +0200
[CAMEL-11807] Upgrade camel-pg-replication-slot to junit5
---
components/camel-pg-replication-slot/pom.xml | 4 ++--
.../slot/PgReplicationSlotEndpointTest.java | 22 ++++++++--------------
.../PgReplicationSlotIntegrationTest.java | 12 ++++++------
3 files changed, 16 insertions(+), 22 deletions(-)
diff --git a/components/camel-pg-replication-slot/pom.xml b/components/camel-pg-replication-slot/pom.xml
index b6cac3c..66da9db 100644
--- a/components/camel-pg-replication-slot/pom.xml
+++ b/components/camel-pg-replication-slot/pom.xml
@@ -49,12 +49,12 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-test</artifactId>
+ <artifactId>camel-test-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
+ <artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
diff --git a/components/camel-pg-replication-slot/src/test/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotEndpointTest.java b/components/camel-pg-replication-slot/src/test/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotEndpointTest.java
index aa078bf..7e9a06b 100644
--- a/components/camel-pg-replication-slot/src/test/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotEndpointTest.java
+++ b/components/camel-pg-replication-slot/src/test/java/org/apache/camel/component/pg/replication/slot/PgReplicationSlotEndpointTest.java
@@ -16,21 +16,17 @@
*/
package org.apache.camel.component.pg.replication.slot;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.junit.runner.RunWith;
-import org.mockito.junit.MockitoJUnitRunner;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.junit.jupiter.MockitoExtension;
-import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.Mockito.mock;
-@RunWith(MockitoJUnitRunner.class)
+@ExtendWith(MockitoExtension.class)
public class PgReplicationSlotEndpointTest {
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
@Test
public void testUriParsing() {
PgReplicationSlotEndpoint endpoint = null;
@@ -71,10 +67,8 @@ public class PgReplicationSlotEndpointTest {
@Test
public void testParsingBadUri() {
- this.expectedException.expect(IllegalArgumentException.class);
-
PgReplicationSlotComponent component = mock(PgReplicationSlotComponent.class);
-
- new PgReplicationSlotEndpoint("pg-replication-slot:/database/slot", component);
+ assertThrows(IllegalArgumentException.class,
+ () -> new PgReplicationSlotEndpoint("pg-replication-slot:/database/slot", component));
}
}
diff --git a/components/camel-pg-replication-slot/src/test/java/org/apache/camel/component/pg/replication/slot/integration/PgReplicationSlotIntegrationTest.java b/components/camel-pg-replication-slot/src/test/java/org/apache/camel/component/pg/replication/slot/integration/PgReplicationSlotIntegrationTest.java
index 701c9b9..c709442 100644
--- a/components/camel-pg-replication-slot/src/test/java/org/apache/camel/component/pg/replication/slot/integration/PgReplicationSlotIntegrationTest.java
+++ b/components/camel-pg-replication-slot/src/test/java/org/apache/camel/component/pg/replication/slot/integration/PgReplicationSlotIntegrationTest.java
@@ -29,10 +29,10 @@ import org.apache.camel.PropertyInject;
import org.apache.camel.RoutesBuilder;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.apache.camel.test.junit5.CamelTestSupport;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class PgReplicationSlotIntegrationTest extends CamelTestSupport {
@@ -61,7 +61,7 @@ public class PgReplicationSlotIntegrationTest extends CamelTestSupport {
private Connection connection;
@Override
- @Before
+ @BeforeEach
public void setUp() throws Exception {
super.setUp();
@@ -77,7 +77,7 @@ public class PgReplicationSlotIntegrationTest extends CamelTestSupport {
}
@Override
- @After
+ @AfterEach
public void tearDown() throws Exception {
super.tearDown();