From 695f3203ff26eb9b69eb48dcef61e9257eca840c Mon Sep 17 00:00:00 2001 From: Martin Goik <goik@hdm-stuttgart.de> Date: Thu, 29 Mar 2018 00:34:25 +0200 Subject: [PATCH] Junit 5 upgrade --- ws/Archetypes/archetype-catalog.xml | 8 ++++++++ ws/Archetypes/mi-maven-archetype-quickstart/pom.xml | 2 +- .../src/main/resources/archetype-resources/pom.xml | 13 ++++++++++--- .../archetype-resources/src/main/java/App.java | 11 +++++++++++ .../archetype-resources/src/test/java/AppTest.java | 6 +++--- 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/ws/Archetypes/archetype-catalog.xml b/ws/Archetypes/archetype-catalog.xml index 4c2700fc5..b5be721ab 100644 --- a/ws/Archetypes/archetype-catalog.xml +++ b/ws/Archetypes/archetype-catalog.xml @@ -14,6 +14,14 @@ <description>Modified from maven-archetype-quickstart using Java 1.8, log4j 2.x and Junit 4</description> </archetype> + <archetype> + <groupId>de.hdm-stuttgart.mi</groupId> + <artifactId>mi-maven-archetype-quickstart</artifactId> + <version>1.2</version> + <repository>https://maven.mi.hdm-stuttgart.de/Archetypes</repository> + <description>Modified from maven-archetype-quickstart using Java 1.8, log4j 2.x and Junit 4</description> + </archetype> + <archetype> <groupId>de.hdm-stuttgart.mi</groupId> <artifactId>mi-maven-archetype-javafxml</artifactId> diff --git a/ws/Archetypes/mi-maven-archetype-quickstart/pom.xml b/ws/Archetypes/mi-maven-archetype-quickstart/pom.xml index 6e53460cc..83ea038ac 100644 --- a/ws/Archetypes/mi-maven-archetype-quickstart/pom.xml +++ b/ws/Archetypes/mi-maven-archetype-quickstart/pom.xml @@ -4,7 +4,7 @@ <groupId>de.hdm-stuttgart.mi</groupId> <artifactId>mi-maven-archetype-quickstart</artifactId> - <version>1.1</version> + <version>1.2</version> <packaging>jar</packaging> <distributionManagement> <!-- mvn deploy --> diff --git a/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/archetype-resources/pom.xml b/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/archetype-resources/pom.xml index 63c0f0a9a..077b79452 100644 --- a/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/archetype-resources/pom.xml +++ b/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/archetype-resources/pom.xml @@ -17,9 +17,16 @@ <dependencies> <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.12</version> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-api</artifactId> + <version>5.1.0</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-engine</artifactId> + <version>5.1.0</version> <scope>test</scope> </dependency> diff --git a/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/archetype-resources/src/main/java/App.java b/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/archetype-resources/src/main/java/App.java index 7406b99b0..686389d71 100644 --- a/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/archetype-resources/src/main/java/App.java +++ b/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/archetype-resources/src/main/java/App.java @@ -26,4 +26,15 @@ public class App { log.debug("This config file 'log4j2.xml' will result in 'A1.log'"); log.debug("file containing logging output as well."); } + + /** + * This method purely exists for providing Junit tests. + * + * @param a first parameter + * @param b second parameter + * @return the sum of both parameters. + */ + public static int add(final int a, final int b) { + return a + b; + } } diff --git a/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/archetype-resources/src/test/java/AppTest.java b/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/archetype-resources/src/test/java/AppTest.java index e158e33c7..6b7fb8955 100644 --- a/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/archetype-resources/src/test/java/AppTest.java +++ b/ws/Archetypes/mi-maven-archetype-quickstart/src/main/resources/archetype-resources/src/test/java/AppTest.java @@ -1,7 +1,7 @@ package $package; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; /** * Unit test for simple App. @@ -12,6 +12,6 @@ public class AppTest { */ @Test public void testApp() { - Assert.assertTrue( true ); + Assertions.assertEquals( 33, App.add(30, 3)); } } -- GitLab