Remove useless public identifiers and fix test suite SelectPackagesSuiteUnitTest which did not discover any tests
This commit is contained in:
parent
8356dc6ba2
commit
c7b8e634a8
|
@ -4,10 +4,10 @@ import org.junit.Test;
|
|||
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
|
||||
public class CalculatorUnitTest {
|
||||
class CalculatorUnitTest {
|
||||
|
||||
@Test
|
||||
public void whenDividerIsZero_thenDivideByZeroExceptionIsThrown() {
|
||||
void whenDividerIsZero_thenDivideByZeroExceptionIsThrown() {
|
||||
Calculator calculator = new Calculator();
|
||||
|
||||
assertThrows(DivideByZeroException.class,
|
||||
|
|
|
@ -6,7 +6,7 @@ import org.junit.jupiter.api.DisplayName;
|
|||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
public class CustomNameUnitTest {
|
||||
class CustomNameUnitTest {
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = { "Hello", "World" })
|
||||
|
|
|
@ -12,7 +12,7 @@ import org.junit.jupiter.params.provider.EnumSource;
|
|||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
||||
public class ParameterizedUnitTest {
|
||||
class ParameterizedUnitTest {
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = { "Hello", "World" })
|
||||
|
|
|
@ -5,6 +5,6 @@ import org.junit.platform.suite.api.Suite;
|
|||
|
||||
@Suite
|
||||
@SelectClasses({Class1UnitTest.class, Class2UnitTest.class})
|
||||
public class SelectClassesSuiteUnitTest {
|
||||
class SelectClassesSuiteUnitTest {
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import org.junit.platform.suite.api.SelectPackages;
|
|||
import org.junit.platform.suite.api.Suite;
|
||||
|
||||
@Suite
|
||||
@SelectPackages({ "com.baeldung.java.suite.junit4", "com.baeldung.java.suite.junit5" })
|
||||
public class SelectPackagesSuiteUnitTest {
|
||||
@SelectPackages({ "com.baeldung.junit4", "com.baeldung.junit5" })
|
||||
class SelectPackagesSuiteUnitTest {
|
||||
|
||||
}
|
||||
|
|
|
@ -12,33 +12,33 @@ import org.junit.jupiter.api.BeforeEach;
|
|||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class SummationServiceUnitTest {
|
||||
class SummationServiceUnitTest {
|
||||
private static List<Integer> numbers;
|
||||
|
||||
@BeforeAll
|
||||
public static void initialize() {
|
||||
static void initialize() {
|
||||
numbers = new ArrayList<>();
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
public static void tearDown() {
|
||||
static void tearDown() {
|
||||
numbers = null;
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
public void runBeforeEachTest() {
|
||||
void runBeforeEachTest() {
|
||||
numbers.add(1);
|
||||
numbers.add(2);
|
||||
numbers.add(3);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
public void runAfterEachTest() {
|
||||
void runAfterEachTest() {
|
||||
numbers.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void givenNumbers_sumEquals_thenCorrect() {
|
||||
void givenNumbers_sumEquals_thenCorrect() {
|
||||
int sum = numbers.stream()
|
||||
.reduce(0, Integer::sum);
|
||||
Assert.assertEquals(6, sum);
|
||||
|
@ -46,7 +46,7 @@ public class SummationServiceUnitTest {
|
|||
|
||||
@Disabled
|
||||
@Test
|
||||
public void givenEmptyList_sumEqualsZero_thenCorrect() {
|
||||
void givenEmptyList_sumEqualsZero_thenCorrect() {
|
||||
int sum = numbers.stream()
|
||||
.reduce(0, Integer::sum);
|
||||
Assert.assertEquals(6, sum);
|
||||
|
|
Loading…
Reference in New Issue