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 7fc32c0cc0..3a873a6d29 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 @@ -29,6 +29,6 @@ public class AlphanumericOrderUnitTest { @AfterAll public static void assertOutput() { - assertEquals(output.toString(), "ABa"); + assertEquals("ABa", output.toString()); } } 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 472c98e923..299a3cad85 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 @@ -9,7 +9,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; @TestMethodOrder(CustomOrder.class) public class CustomOrderUnitTest { - private static StringBuilder output = new StringBuilder(""); + private static final StringBuilder output = new StringBuilder(""); @Test void myATest() { @@ -26,9 +26,8 @@ public class CustomOrderUnitTest { output.append("a"); } - @AfterAll public static void assertOutput() { - assertEquals(output.toString(), "AaB"); + assertEquals("AaB", output.toString()); } } 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 72c8bcc2a9..14cf6c552e 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 @@ -7,7 +7,8 @@ import static org.junit.jupiter.api.Assertions.*; @TestMethodOrder(OrderAnnotation.class) public class OrderAnnotationUnitTest { - private static StringBuilder output = new StringBuilder(""); + + private static final StringBuilder output = new StringBuilder(); @Test @Order(1) @@ -29,6 +30,6 @@ public class OrderAnnotationUnitTest { @AfterAll public static void assertOutput() { - assertEquals(output.toString(), "abc"); + assertEquals("abc", output.toString()); } }