Last active
January 18, 2018 06:25
-
-
Save b1a9id/ef381bfe82d397387a9e978a1eda5cb8 to your computer and use it in GitHub Desktop.
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 MethodSourceParameterizedTest { | |
// ファクトリーメソッド1つのテスト | |
@ParameterizedTest | |
@MethodSource("range") | |
void methodSourceIntStream(int value) { | |
assertTrue(value > 0 && value < 10); | |
} | |
static IntStream range() { | |
return IntStream.range(1, 10); | |
} | |
// ファクトリーメソッド複数のテスト | |
@ParameterizedTest | |
@MethodSource({"fullNameProvider1", "fullNameProvider2"}) | |
void methodSourceStream(String fullName) { | |
assertNotNull(fullName); | |
assertTrue(fullName.contains(" ")); | |
} | |
static Stream<String> fullNameProvider1() { | |
return Stream.of("Ryosuke Uchitate", "Taro Uchitate"); | |
} | |
static Stream<String> fullNameProvider2() { | |
return Stream.of("Michael Jackson", "Janet Jackson"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment