JUnit5 test classes and methods should be package-private.
Unlike JUnit4 which required all the test classes and methods to be declared public
, in JUnit5 they can be anything but private
.
To enforce maximum encapsulation, it is recommended to declare test classes and methods as package-private.
public class MyTest {
@Test
public void testThis() {
// ..test things
}
}
Consider making your test classes and methods package-private.
class MyTest {
@Test
void testThis() {
// ..test things
}
}