This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CsvFileSourceParameterizedTest { | |
/** | |
* CSV File Source | |
*/ | |
@ParameterizedTest | |
@CsvFileSource(resources = "test.csv") | |
void csvFileSource(String first, int second) { | |
assertNotNull(first); | |
assertNotEquals(0, second); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CsvSourceParameterizedTest { | |
/** | |
* CSV Source | |
*/ | |
@ParameterizedTest | |
@CsvSource({"foo, bar", "foo, 'bar, hoge'", "foo, ''", "foo, "}) | |
void csvSource(String first, String second) { | |
System.out.println(String.format("first: %s, second: %s", first, second)); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ParameterizedTestDemo { | |
@ParameterizedTest | |
@EnumSource(Gender.class) | |
void enumSourceAll(Gender gender) { | |
assertTrue(Arrays.asList(Gender.values()).contains(gender)); | |
} | |
@ParameterizedTest | |
@EnumSource(value = Gender.class, names = {"MAN", "WOMAN"}) | |
void enumSourceInclude(Gender gender) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public enum Gender { | |
MAN, WOMAN | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Person { | |
private String firstName; | |
private String lastName; | |
private int age; | |
private Gender gender; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StringsValueParameterizedTestDemo { | |
private Person person1; | |
private Person person2; | |
@BeforeEach | |
void beforeEach() { | |
person1 = new Person("Ryosuke", "Uchitate", 27, Gender.MAN); | |
person2 = new Person("Taro", "Uchitate", 20, Gender.MAN); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PageWrapperTest { | |
private PageWrapper pageWrapper; | |
@Mock | |
private Page page; | |
private Method initPaginationMethod; | |
private int totalPages; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private List<Integer> initPagination(int paginationSize) { | |
if (getTotalPages() < paginationSize) { | |
return IntStream.range(0, paginationSize) | |
.boxed() | |
.collect(Collectors.toList()); | |
} | |
// ページネーションサイズが偶数かどうか | |
boolean isEvenSize = paginationSize % 2 == 0; | |
int currentPageNumber = this.page.getNumber(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
About to execute repetition 1 of 3 for RepeatedTestDemo#noArgs | |
About to execute repetition 2 of 3 for RepeatedTestDemo#noArgs | |
About to execute repetition 3 of 3 for RepeatedTestDemo#noArgs | |
About to execute repetition 1 of 1 for RepeatedTestDemo#customDisplayNameLongPattern | |
About to execute repetition 1 of 3 for RepeatedTestDemo#totalRepetitionsInfo | |
About to execute repetition 2 of 3 for RepeatedTestDemo#totalRepetitionsInfo | |
About to execute repetition 3 of 3 for RepeatedTestDemo#totalRepetitionsInfo | |
About to execute repetition 1 of 3 for RepeatedTestDemo#customDisplayName | |
About to execute repetition 2 of 3 for RepeatedTestDemo#customDisplayName | |
About to execute repetition 3 of 3 for RepeatedTestDemo#customDisplayName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.junit.jupiter.api.*; | |
import static org.junit.jupiter.api.Assertions.*; | |
class RepeatedTestDemo { | |
@BeforeEach | |
void beforeEach(TestInfo testInfo, RepetitionInfo repetitionInfo) { | |
// 現在の回数 | |
int currentRepetition = repetitionInfo.getCurrentRepetition(); |