Java 类org.junit.jupiter.params.provider.ValueSource 实例源码
项目:dollar
文件:ParserQuickTest.java
@ParameterizedTest
@ValueSource(
// "bulletin.ds",
// "example.ds",
strings = {"quick/test_pipe1.ds", "quick/test_emit.ds", "quick/test_variable_declarations.ds", "quick/test_print1.ds", "quick/test_classes.ds", "quick/test_variables1.ds", "quick/test_variables2.ds", "quick/test_variables3.ds", "quick/test_variables4.ds", "quick/test_variables5.ds", "quick/test_date.ds", "quick/test_block_closure.ds", "quick/test_list_closure.ds", "quick/test_map_closure.ds", "quick/test_scopes.ds",
"quick/test1.ds",
"quick/test_arrays.ds", "quick/test_builtins.ds", "quick/test_casting.ds", "quick/test_date.ds", "quick/test_fix1.ds",
"quick/test_fix2.ds", "quick/test_fix3.ds", "quick/test_iteration.ds", "quick/test_java.ds", "quick/test_logic.ds",
"quick/test_numeric.ds", "quick/test_parameters.ds", "quick/test_pure1.ds", "quick/test_pure2.ds", "quick/test_pure3.ds", "quick/test_pure4.ds", "quick/test_ranges.ds", "quick/test_reactive1.ds",
"quick/test_reactive2.ds", "quick/test_reactive3.ds", "quick/test_reactive4.ds", "quick/test_reactive5.ds",
"quick/test_reactive6.ds", "quick/test_reactive7.ds", "quick/test_reactive8.ds", "quick/test_strings.ds",
"quick/test_control_flow.ds",
"quick/test3.ds", "quick/test_types_1.ds"})
public void testScript(@NotNull String filename) throws Exception {
util().clearScopes();
System.out.println("Testing " + filename);
new DollarParserImpl(options).parse(getClass().getResourceAsStream("/" + filename), filename, parallel);
}
项目:mastering-junit5
文件:ValueSourceStringsParameterizedTest.java
@ParameterizedTest
@ValueSource(strings = { "Hello", "World" })
void testWithStrings(String argument) {
System.out.println(
"Parameterized test with (String) parameter: " + argument);
assertNotNull(argument);
}
项目:mastering-junit5
文件:ValueSourcePrimitiveTypesParameterizedTest.java
@ParameterizedTest
@ValueSource(ints = { 0, 1 })
void testWithInts(int argument) {
System.out
.println("Parameterized test with (int) argument: " + argument);
assertNotNull(argument);
}
项目:mastering-junit5
文件:ValueSourcePrimitiveTypesParameterizedTest.java
@ParameterizedTest
@ValueSource(longs = { 2L, 3L })
void testWithLongs(long argument) {
System.out.println(
"Parameterized test with (long) argument: " + argument);
assertNotNull(argument);
}
项目:mastering-junit5
文件:ValueSourcePrimitiveTypesParameterizedTest.java
@ParameterizedTest
@ValueSource(doubles = { 4d, 5d })
void testWithDoubles(double argument) {
System.out.println(
"Parameterized test with (double) argument: " + argument);
assertNotNull(argument);
}
项目:mastering-junit5
文件:ImplicitConversionParameterizedTest.java
@ParameterizedTest
@ValueSource(strings = "true")
void testWithImplicitConversionToBoolean(Boolean argument) {
System.out.println("Argument " + argument + " is a type of "
+ argument.getClass());
assertTrue(argument);
}
项目:mastering-junit5
文件:ImplicitConversionParameterizedTest.java
@ParameterizedTest
@ValueSource(strings = "11")
void testWithImplicitConversionToInteger(Integer argument) {
System.out.println("Argument " + argument + " is a type of "
+ argument.getClass());
assertTrue(argument > 10);
}
项目:mastering-junit5
文件:ImplicitConversionParameterizedTest.java
@ParameterizedTest
@ValueSource(strings = "SECONDS")
void testWithImplicitConversionToEnum(TimeUnit argument) {
System.out.println("Argument " + argument + " is a type of "
+ argument.getDeclaringClass());
assertNotNull(argument.name());
}
项目:mastering-junit5
文件:ImplicitConversionParameterizedTest.java
@ParameterizedTest
@ValueSource(strings = "2017-07-25")
void testWithImplicitConversionToLocalDate(LocalDate argument) {
System.out.println("Argument " + argument + " is a type of "
+ argument.getClass());
assertNotNull(argument);
}
项目:junit5-extensions
文件:UsageExampleTests.java
@ParameterizedTest
@ValueSource(strings = {
"java.util.List",
"java.util.Collection",
"java.lang.Object",
})
void anySuperclass(
@ConvertWith(ClassArgumentConverter.class) Class<? super List<?>> superclassOfList) {
assertThat(superclassOfList).isNotNull();
}
项目:junit5-extensions
文件:UsageExampleTests.java
@ParameterizedTest
@ValueSource(strings = {
"java.util.List",
"java.util.ArrayList",
})
void anySubclass(@ConvertWith(ClassArgumentConverter.class) Class<? extends List<?>> anything) {
assertThat(anything).isNotNull();
}
项目:junit5-extensions
文件:UsageExampleTests.java
@ExpectFailure({
@Cause(type = ParameterResolutionException.class),
@Cause(type = ArgumentConversionException.class),
@Cause(type = ClassNotFoundException.class)
})
@ParameterizedTest
@ValueSource(strings = "123ClassDoesNotExist")
void classNotFound(@ConvertWith(ClassArgumentConverter.class) Class<?> clazz) {}
项目:junit5-extensions
文件:UsageExampleTests.java
@ExpectFailure({
@Cause(type = ParameterResolutionException.class),
@Cause(type = ArgumentConversionException.class, message = "Invalid parameter type")
})
@ParameterizedTest
@ValueSource(strings = "java.lang.Object")
void badParameterType(@ConvertWith(ClassArgumentConverter.class) String clazz) {}
项目:junit5-extensions
文件:UsageExampleTests.java
@ExpectFailure({
@Cause(type = ParameterResolutionException.class),
@Cause(
type = ArgumentConversionException.class,
message = "java.lang.Class<java.util.List> is not assignable to"
+ " java.lang.Class<java.util.Collection<?>>"
)
})
@ParameterizedTest
@ValueSource(strings = "java.util.List")
void wrongClass(@ConvertWith(ClassArgumentConverter.class) Class<Collection<?>> clazz) {}
项目:junit5-extensions
文件:UsageExampleTests.java
@ExpectFailure({
@Cause(type = ParameterResolutionException.class),
@Cause(type = ArgumentConversionException.class, message = "is not assignable to")
})
@ParameterizedTest
@ValueSource(strings = "java.util.List")
void badLowerBound(
@ConvertWith(ClassArgumentConverter.class) Class<? super Collection<?>> clazz) {}
项目:junit5-extensions
文件:UsageExampleTests.java
@ExpectFailure({
@Cause(type = ParameterResolutionException.class),
@Cause(type = ArgumentConversionException.class, message = "is not assignable to")
})
@ParameterizedTest
@ValueSource(strings = "java.lang.Object")
void badUpperBound(
@ConvertWith(ClassArgumentConverter.class) Class<? extends Collection<?>> clazz) {}
项目:shuffleboard
文件:NumberFieldTest.java
@ParameterizedTest
@ValueSource(strings = {"0.0", "1.0", "12.56", "-0", "-1", "-10", "+0", "+55.99", "-54.21"})
public void validNumberTest(String number) {
interact(numberField::clear);
clickOn(".text-field").write(number);
assertEquals(Double.parseDouble(number), numberField.getNumber().doubleValue());
}
项目:Mastering-Software-Testing-with-JUnit-5
文件:ValueSourceStringsParameterizedTest.java
@ParameterizedTest
@ValueSource(strings = { "Hello", "World" })
void testWithStrings(String argument) {
System.out.println(
"Parameterized test with (String) parameter: " + argument);
assertNotNull(argument);
}
项目:Mastering-Software-Testing-with-JUnit-5
文件:ValueSourcePrimitiveTypesParameterizedTest.java
@ParameterizedTest
@ValueSource(ints = { 0, 1 })
void testWithInts(int argument) {
System.out
.println("Parameterized test with (int) argument: " + argument);
assertNotNull(argument);
}
项目:Mastering-Software-Testing-with-JUnit-5
文件:ValueSourcePrimitiveTypesParameterizedTest.java
@ParameterizedTest
@ValueSource(longs = { 2L, 3L })
void testWithLongs(long argument) {
System.out.println(
"Parameterized test with (long) argument: " + argument);
assertNotNull(argument);
}
项目:Mastering-Software-Testing-with-JUnit-5
文件:ValueSourcePrimitiveTypesParameterizedTest.java
@ParameterizedTest
@ValueSource(doubles = { 4d, 5d })
void testWithDoubles(double argument) {
System.out.println(
"Parameterized test with (double) argument: " + argument);
assertNotNull(argument);
}
项目:Mastering-Software-Testing-with-JUnit-5
文件:ImplicitConversionParameterizedTest.java
@ParameterizedTest
@ValueSource(strings = "true")
void testWithImplicitConversionToBoolean(Boolean argument) {
System.out.println("Argument " + argument + " is a type of "
+ argument.getClass());
assertTrue(argument);
}
项目:Mastering-Software-Testing-with-JUnit-5
文件:ImplicitConversionParameterizedTest.java
@ParameterizedTest
@ValueSource(strings = "11")
void testWithImplicitConversionToInteger(Integer argument) {
System.out.println("Argument " + argument + " is a type of "
+ argument.getClass());
assertTrue(argument > 10);
}
项目:Mastering-Software-Testing-with-JUnit-5
文件:ImplicitConversionParameterizedTest.java
@ParameterizedTest
@ValueSource(strings = "SECONDS")
void testWithImplicitConversionToEnum(TimeUnit argument) {
System.out.println("Argument " + argument + " is a type of "
+ argument.getDeclaringClass());
assertNotNull(argument.name());
}
项目:Mastering-Software-Testing-with-JUnit-5
文件:ImplicitConversionParameterizedTest.java
@ParameterizedTest
@ValueSource(strings = "2017-07-25")
void testWithImplicitConversionToLocalDate(LocalDate argument) {
System.out.println("Argument " + argument + " is a type of "
+ argument.getClass());
assertNotNull(argument);
}
项目:roboslack
文件:WebHookTokenTests.java
@ParameterizedTest
@ValueSource(strings = {
"T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX",
"https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX"})
void testFromString(String input) {
WebHookToken token = WebHookToken.fromString(input);
Assertions.assertFalse(Strings.isNullOrEmpty(token.partB()));
Assertions.assertFalse(Strings.isNullOrEmpty(token.partT()));
Assertions.assertFalse(Strings.isNullOrEmpty(token.partX()));
Assertions.assertFalse(Strings.isNullOrEmpty(token.toString()));
}
项目:roboslack
文件:ColorTests.java
@ParameterizedTest
@ValueSource(strings = {
"#abcdef",
"#123456"})
void testValid(String input) {
Color color = Color.of(input);
assertValid(color);
assertFalse(color.isPreset());
Throwable thrown = assertThrows(UnsupportedOperationException.class, color::asPreset);
assertThat(thrown.getMessage(), containsString("not a defined preset"));
}
项目:roboslack
文件:ColorTests.java
@ParameterizedTest
@ValueSource(strings = {
"not-a-hex-color",
"123456",
""})
void testInvalid(String input) {
Throwable thrown = assertThrows(IllegalArgumentException.class, () -> Color.of(input));
assertThat(thrown.getMessage(), containsString("not a valid hex color"));
}
项目:VocabHunter
文件:FormatHandlingTest.java
@ParameterizedTest
@ValueSource(strings = {FORMAT_1, FORMAT_2, FORMAT_3, FORMAT_4, FORMAT_5, FORMAT_UNEXPECTED_FIELD})
public void testSupportedVersion(final String filename) throws Exception {
Path file = getResourceFile(filename);
EnrichedSessionState expected = new EnrichedSessionState(EXPECTED_STATE, file);
assertAll(
() -> validateMarkedWords(file, expected),
() -> validateState(file, expected)
);
}
项目:GitToolBox
文件:RegExpFormatterTest.java
@DisplayName("Formatting with empty")
@ParameterizedTest(name = "Input formatted with ''{0}'' should return input")
@ValueSource(strings = {" ", ""})
void formatShouldReturnInputIfPatternEmpty(String pattern) {
final String input = "abc";
assertEquals(input, RegExpFormatter.create(pattern).format(input).text);
}
项目:dollar
文件:ParserSlowTest.java
@ParameterizedTest
@ValueSource(
// "bulletin.ds",
// "example.ds",
strings = {"slow/air_quality.ds", "slow/test_redis.ds",
"slow/test_uris.ds", "slow/test_concurrency.ds",
"slow/test_modules.ds"})
public void testScript(@NotNull String filename) throws Exception {
System.out.println("Testing " + filename);
new DollarParserImpl(options).parse(getClass().getResourceAsStream("/" + filename), filename, parallel);
}
项目:testing-video
文件:QuantizationBase8.java
@ParameterizedTest
@ValueSource(ints = {16, 32})
public void quantsNearBlack(int yCode) {
quants("NearBlack", yCode); // 16
}
项目:testing-video
文件:QuantizationBase8.java
@ParameterizedTest
@ValueSource(ints = {48, 64})
public void quantsDarkGray(int yCode) {
quants("DarkGray", yCode); // 16
}
项目:testing-video
文件:QuantizationBase8.java
@ParameterizedTest
@ValueSource(ints = {96, 128})
public void quantsGray(int yCode) {
quants("Gray", yCode); // 32
}
项目:testing-video
文件:QuantizationBase8.java
@ParameterizedTest
@ValueSource(ints = {160, 192})
public void quantsLightGray(int yCode) {
quants("LightGray", yCode); // 32
}
项目:testing-video
文件:QuantizationBase8.java
@ParameterizedTest
@ValueSource(ints = 204)
public void quantsNearWhite(int yCode) {
quants("NearWhite", yCode); // 20
}
项目:testing-video
文件:QuantizationBase8.java
@ParameterizedTest
@ValueSource(ints = 224)
public void quantsBright(int yCode) {
quants("Bright", yCode); // 20
}
项目:testing-video
文件:QuantizationBase10.java
@ParameterizedTest
@ValueSource(ints = {64, 96})
public void quantsNearBlack(int yCode) {
quants("NearBlack", yCode); // 32
}
项目:testing-video
文件:QuantizationBase10.java
@ParameterizedTest
@ValueSource(ints = {128, 160})
public void quantsDarkGray(int yCode) {
quants("DarkGray", yCode); // 32
}
项目:testing-video
文件:QuantizationBase10.java
@ParameterizedTest
@ValueSource(ints = {192, 256})
public void quantsGray(int yCode) {
quants("Gray", yCode); // 64
}