JUnit5 test classes and methods should have default package visibility

This commit is contained in:
Alex Golub 2022-04-22 21:21:20 +03:00
parent 4bcb36ff41
commit da30a3efd7
5 changed files with 31 additions and 29 deletions

View File

@ -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");
}

View File

@ -8,20 +8,21 @@ 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() {
void myBTest() {
output.append("B");
}
@Test
public void myaTest() {
void myaTest() {
output.append("a");
}

View File

@ -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");
}

View File

@ -14,19 +14,19 @@ public class OrderAnnotationUnitTest {
@Test
@Order(1)
public void firstTest() {
void firstTest() {
output.append("a");
}
@Test
@Order(2)
public void secondTest() {
void secondTest() {
output.append("b");
}
@Test
@Order(3)
public void thirdTest() {
void thirdTest() {
output.append("c");
}

View File

@ -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");
}