1@TestMethodOrder(OrderAnnotation.class)
2public class OrderAnnotationUnitTest {
3 private static StringBuilder output = new StringBuilder("");
4
5 @Test
6 @Order(1)
7 public void firstTest() {
8 output.append("a");
9 }
10
11 @Test
12 @Order(2)
13 public void secondTest() {
14 output.append("b");
15 }
16
17 @Test
18 @Order(3)
19 public void thirdTest() {
20 output.append("c");
21 }
22
23 @AfterAll
24 public static void assertOutput() {
25 assertEquals(output.toString(), "abc");
26 }
27}
28