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 4cb2953e0a47bd4a1eaf679940cf1070e09804e9 Author: Guillaume Nodet <gno...@gmail.com> AuthorDate: Tue Jun 30 09:06:26 2020 +0200 [CAMEL-11807] Upgrade camel-ipfs to junit5 --- components/camel-ipfs/pom.xml | 4 ++-- .../camel/component/ipfs/SimpleIPFSTest.java | 24 ++++++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/components/camel-ipfs/pom.xml b/components/camel-ipfs/pom.xml index 95d843f..b776d33 100644 --- a/components/camel-ipfs/pom.xml +++ b/components/camel-ipfs/pom.xml @@ -47,8 +47,8 @@ <!-- Test --> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter</artifactId> <scope>test</scope> </dependency> <dependency> diff --git a/components/camel-ipfs/src/test/java/org/apache/camel/component/ipfs/SimpleIPFSTest.java b/components/camel-ipfs/src/test/java/org/apache/camel/component/ipfs/SimpleIPFSTest.java index 3852173..fbb0c25 100644 --- a/components/camel-ipfs/src/test/java/org/apache/camel/component/ipfs/SimpleIPFSTest.java +++ b/components/camel-ipfs/src/test/java/org/apache/camel/component/ipfs/SimpleIPFSTest.java @@ -29,9 +29,11 @@ import org.apache.camel.CamelContext; import org.apache.camel.ProducerTemplate; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.impl.DefaultCamelContext; -import org.junit.Assert; import org.junit.Assume; -import org.junit.Test; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; /* @@ -72,7 +74,7 @@ public class SimpleIPFSTest { try { ProducerTemplate producer = camelctx.createProducerTemplate(); String resA = producer.requestBody("direct:startA", null, String.class); - Assert.assertTrue("Expecting 0.4 in: " + resA, resA.startsWith("0.4")); + assertTrue(resA.startsWith("0.4"), "Expecting 0.4 in: " + resA); } catch (Exception e) { boolean notRunning = e.getCause().getMessage().contains("Is IPFS running"); Assume.assumeFalse("IPFS is running", notRunning); @@ -98,7 +100,7 @@ public class SimpleIPFSTest { Path path = Paths.get("src/test/resources/html/etc/userfile.txt"); ProducerTemplate producer = camelctx.createProducerTemplate(); String res = producer.requestBody("direct:start", path, String.class); - Assert.assertEquals(SINGLE_HASH, res); + assertEquals(SINGLE_HASH, res); } catch (Exception e) { boolean notRunning = e.getCause().getMessage().contains("Is IPFS running"); Assume.assumeFalse("IPFS is running", notRunning); @@ -125,8 +127,8 @@ public class SimpleIPFSTest { Path path = Paths.get("src/test/resources/html"); ProducerTemplate producer = camelctx.createProducerTemplate(); List<String> res = producer.requestBody("direct:start", path, List.class); - Assert.assertEquals(10, res.size()); - Assert.assertEquals(RECURSIVE_HASH, res.get(9)); + assertEquals(10, res.size()); + assertEquals(RECURSIVE_HASH, res.get(9)); } catch (Exception e) { boolean notRunning = e.getCause().getMessage().contains("Is IPFS running"); Assume.assumeFalse("IPFS is running", notRunning); @@ -176,7 +178,7 @@ public class SimpleIPFSTest { try { ProducerTemplate producer = camelctx.createProducerTemplate(); Path res = producer.requestBody("direct:start", SINGLE_HASH, Path.class); - Assert.assertEquals(Paths.get("target", SINGLE_HASH), res); + assertEquals(Paths.get("target", SINGLE_HASH), res); verifyFileContent(new FileInputStream(res.toFile())); } catch (Exception e) { boolean notRunning = e.getCause().getMessage().contains("Is IPFS running"); @@ -202,9 +204,9 @@ public class SimpleIPFSTest { try { ProducerTemplate producer = camelctx.createProducerTemplate(); Path res = producer.requestBody("direct:start", RECURSIVE_HASH, Path.class); - Assert.assertEquals(Paths.get("target", RECURSIVE_HASH), res); - Assert.assertTrue(res.toFile().isDirectory()); - Assert.assertTrue(res.resolve("index.html").toFile().exists()); + assertEquals(Paths.get("target", RECURSIVE_HASH), res); + assertTrue(res.toFile().isDirectory()); + assertTrue(res.resolve("index.html").toFile().exists()); } catch (Exception e) { boolean notRunning = e.getCause().getMessage().contains("Is IPFS running"); Assume.assumeFalse("IPFS is running", notRunning); @@ -215,7 +217,7 @@ public class SimpleIPFSTest { private void verifyFileContent(InputStream ins) throws IOException { ByteArrayOutputStream baos = new ByteArrayOutputStream(); StreamUtils.copyStream(ins, baos); - Assert.assertEquals("The quick brown fox jumps over the lazy dog.", new String(baos.toByteArray())); + assertEquals("The quick brown fox jumps over the lazy dog.", new String(baos.toByteArray())); } }