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 873df30400..262166b1a1 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 @@ -1,28 +1,29 @@ 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; +import static org.junit.Assert.assertEquals; + @TestMethodOrder(MethodOrderer.MethodName.class) public class AlphanumericOrderUnitTest { + private static StringBuilder output = new StringBuilder(""); @Test - public void myATest() { + void myATest() { output.append("A"); } @Test - public void myBTest() { + void myBTest() { output.append("B"); } @Test - public void myaTest() { + void myaTest() { output.append("a"); } diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/CustomOrderUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/CustomOrderUnitTest.java index fa45921879..58e6e6304a 100644 --- a/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/CustomOrderUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/CustomOrderUnitTest.java @@ -8,24 +8,25 @@ import org.junit.jupiter.api.TestMethodOrder; @TestMethodOrder(CustomOrder.class) public class CustomOrderUnitTest { + private static StringBuilder output = new StringBuilder(""); - + @Test - public void myATest() { + void myATest() { output.append("A"); } - + @Test - public void myBTest() { - output.append("B"); + void myBTest() { + output.append("B"); } - + @Test - public void myaTest() { + void myaTest() { output.append("a"); } - + @AfterAll public static void assertOutput() { assertEquals(output.toString(), "AaB"); 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 index 65cee3e987..adea7e8888 100644 --- 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 @@ -12,19 +12,19 @@ public class DefaultOrderUnitTest { @Test @DisplayName("Test A") - public void myATest() { + void myATest() { output.append("A"); } @Test @DisplayName("Test B") - public void myBTest() { + void myBTest() { output.append("B"); } @Test @DisplayName("Test C") - public void myCTest() { + void myCTest() { output.append("C"); } diff --git a/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/OrderAnnotationUnitTest.java b/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/OrderAnnotationUnitTest.java index 3d931a4158..f73fcab132 100644 --- a/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/OrderAnnotationUnitTest.java +++ b/testing-modules/junit-5/src/test/java/com/baeldung/junit5/order/OrderAnnotationUnitTest.java @@ -11,25 +11,25 @@ import org.junit.jupiter.api.TestMethodOrder; @TestMethodOrder(OrderAnnotation.class) public class OrderAnnotationUnitTest { private static StringBuilder output = new StringBuilder(""); - + @Test - @Order(1) - public void firstTest() { + @Order(1) + void firstTest() { output.append("a"); } - + @Test - @Order(2) - public void secondTest() { + @Order(2) + void secondTest() { output.append("b"); } - + @Test - @Order(3) - public void thirdTest() { + @Order(3) + void thirdTest() { 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 index 0f64f5bb31..b583cd8f63 100644 --- 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 @@ -13,17 +13,17 @@ public class RandomOrderUnitTest { private static StringBuilder output = new StringBuilder(""); @Test - public void myATest() { + void myATest() { output.append("A"); } @Test - public void myBTest() { + void myBTest() { output.append("B"); } @Test - public void myCTest() { + void myCTest() { output.append("C"); }