From 1f6c74ecabdac1ccdd1032b6df115cce8e158f5d Mon Sep 17 00:00:00 2001 From: Azhwani Date: Tue, 2 Nov 2021 20:25:06 +0100 Subject: [PATCH 1/3] conflits resolution --- testing-modules/junit-5/pom.xml | 3 ++ .../order/AlphanumericOrderUnitTest.java | 14 ++++---- .../junit5/order/DefaultOrderUnitTest.java | 36 +++++++++++++++++++ .../junit5/order/RandomOrderUnitTest.java | 35 ++++++++++++++++++ .../test/resources/junit-platform.properties | 2 ++ 5 files changed, 83 insertions(+), 7 deletions(-) create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/DefaultOrderUnitTest.java create mode 100644 testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/RandomOrderUnitTest.java create mode 100644 testing-modules/junit-5/src/test/resources/junit-platform.properties diff --git a/testing-modules/junit-5/pom.xml b/testing-modules/junit-5/pom.xml index 148abecb0f..9b2518d10b 100644 --- a/testing-modules/junit-5/pom.xml +++ b/testing-modules/junit-5/pom.xml @@ -137,7 +137,10 @@ + 5.8.1 2.23.0 + 1.8.1 + 5.8.1 2.8.2 2.0.0 2.22.0 diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/AlphanumericOrderUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/AlphanumericOrderUnitTest.java index d62ca0c666..873df30400 100644 --- a/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/AlphanumericOrderUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/AlphanumericOrderUnitTest.java @@ -3,29 +3,29 @@ package com.baeldung.junit5.order; import static org.junit.Assert.assertEquals; import org.junit.jupiter.api.AfterAll; -import org.junit.jupiter.api.MethodOrderer.Alphanumeric; +import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; -@TestMethodOrder(Alphanumeric.class) +@TestMethodOrder(MethodOrderer.MethodName.class) public class AlphanumericOrderUnitTest { private static StringBuilder output = new StringBuilder(""); - + @Test public void myATest() { output.append("A"); } - + @Test public void myBTest() { - output.append("B"); + output.append("B"); } - + @Test public void myaTest() { output.append("a"); } - + @AfterAll public static void assertOutput() { assertEquals(output.toString(), "ABa"); diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/DefaultOrderUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/DefaultOrderUnitTest.java new file mode 100644 index 0000000000..65cee3e987 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/DefaultOrderUnitTest.java @@ -0,0 +1,36 @@ +package com.baeldung.junit5.order; + +import static org.junit.Assert.assertEquals; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.DisplayName; +import org.junit.jupiter.api.Test; + +public class DefaultOrderUnitTest { + + private static StringBuilder output = new StringBuilder(""); + + @Test + @DisplayName("Test A") + public void myATest() { + output.append("A"); + } + + @Test + @DisplayName("Test B") + public void myBTest() { + output.append("B"); + } + + @Test + @DisplayName("Test C") + public void myCTest() { + output.append("C"); + } + + @AfterAll + public static void assertOutput() { + assertEquals(output.toString(), "ABC"); + } + +} diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/RandomOrderUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/RandomOrderUnitTest.java new file mode 100644 index 0000000000..0f64f5bb31 --- /dev/null +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/RandomOrderUnitTest.java @@ -0,0 +1,35 @@ +package com.baeldung.junit5.order; + +import static org.junit.Assert.assertEquals; + +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.MethodOrderer; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.TestMethodOrder; + +@TestMethodOrder(MethodOrderer.Random.class) +public class RandomOrderUnitTest { + + private static StringBuilder output = new StringBuilder(""); + + @Test + public void myATest() { + output.append("A"); + } + + @Test + public void myBTest() { + output.append("B"); + } + + @Test + public void myCTest() { + output.append("C"); + } + + @AfterAll + public static void assertOutput() { + assertEquals(output.toString(), "ACB"); + } + +} diff --git a/testing-modules/junit-5/src/test/resources/junit-platform.properties b/testing-modules/junit-5/src/test/resources/junit-platform.properties new file mode 100644 index 0000000000..d25e866b43 --- /dev/null +++ b/testing-modules/junit-5/src/test/resources/junit-platform.properties @@ -0,0 +1,2 @@ +junit.jupiter.execution.order.random.seed=100 +junit.jupiter.testmethod.order.default = org.junit.jupiter.api.MethodOrderer$DisplayName \ No newline at end of file From 54e7d312dc04a291a07a4b0e6847105e904157ee Mon Sep 17 00:00:00 2001 From: Azhwani Date: Tue, 2 Nov 2021 19:58:44 +0100 Subject: [PATCH 2/3] init commit --- .../junit-5/src/test/resources/junit-platform.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing-modules/junit-5/src/test/resources/junit-platform.properties b/testing-modules/junit-5/src/test/resources/junit-platform.properties index d25e866b43..a02be290e0 100644 --- a/testing-modules/junit-5/src/test/resources/junit-platform.properties +++ b/testing-modules/junit-5/src/test/resources/junit-platform.properties @@ -1,2 +1,2 @@ junit.jupiter.execution.order.random.seed=100 -junit.jupiter.testmethod.order.default = org.junit.jupiter.api.MethodOrderer$DisplayName \ No newline at end of file +junit.jupiter.testmethod.order.default = org.junit.jupiter.api.MethodOrderer$DisplayName From a257d47c6c96c101960fc1a920a4c1d3fd4a7390 Mon Sep 17 00:00:00 2001 From: Azhwani Date: Fri, 19 Nov 2021 12:48:29 +0100 Subject: [PATCH 3/3] + Remove junit versions to use those of the main pom --- testing-modules/junit-5/pom.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/testing-modules/junit-5/pom.xml b/testing-modules/junit-5/pom.xml index 9b2518d10b..148abecb0f 100644 --- a/testing-modules/junit-5/pom.xml +++ b/testing-modules/junit-5/pom.xml @@ -137,10 +137,7 @@ - 5.8.1 2.23.0 - 1.8.1 - 5.8.1 2.8.2 2.0.0 2.22.0