本文整理汇总了Java中org.junit.jupiter.params.provider.ValueSource类的典型用法代码示例。如果您正苦于以下问题:Java ValueSource类的具体用法?Java ValueSource怎么用?Java ValueSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ValueSource类属于org.junit.jupiter.params.provider包,在下文中一共展示了ValueSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testScript
import org.junit.jupiter.params.provider.ValueSource; //导入依赖的package包/类
@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);
}
示例2: testWithStrings
import org.junit.jupiter.params.provider.ValueSource; //导入依赖的package包/类
@ParameterizedTest
@ValueSource(strings = { "Hello", "World" })
void testWithStrings(String argument) {
System.out.println(
"Parameterized test with (String) parameter: " + argument);
assertNotNull(argument);
}
示例3: testWithInts
import org.junit.jupiter.params.provider.ValueSource; //导入依赖的package包/类
@ParameterizedTest
@ValueSource(ints = { 0, 1 })
void testWithInts(int argument) {
System.out
.println("Parameterized test with (int) argument: " + argument);
assertNotNull(argument);
}
示例4: testWithLongs
import org.junit.jupiter.params.provider.ValueSource; //导入依赖的package包/类
@ParameterizedTest
@ValueSource(longs = { 2L, 3L })
void testWithLongs(long argument) {
System.out.println(
"Parameterized test with (long) argument: " + argument);
assertNotNull(argument);
}
示例5: testWithDoubles
import org.junit.jupiter.params.provider.ValueSource; //导入依赖的package包/类
@ParameterizedTest
@ValueSource(doubles = { 4d, 5d })
void testWithDoubles(double argument) {
System.out.println(
"Parameterized test with (double) argument: " + argument);
assertNotNull(argument);
}
示例6: testWithImplicitConversionToBoolean
import org.junit.jupiter.params.provider.ValueSource; //导入依赖的package包/类
@ParameterizedTest
@ValueSource(strings = "true")
void testWithImplicitConversionToBoolean(Boolean argument) {
System.out.println("Argument " + argument + " is a type of "
+ argument.getClass());
assertTrue(argument);
}
示例7: testWithImplicitConversionToInteger
import org.junit.jupiter.params.provider.ValueSource; //导入依赖的package包/类
@ParameterizedTest
@ValueSource(strings = "11")
void testWithImplicitConversionToInteger(Integer argument) {
System.out.println("Argument " + argument + " is a type of "
+ argument.getClass());
assertTrue(argument > 10);
}
示例8: testWithImplicitConversionToEnum
import org.junit.jupiter.params.provider.ValueSource; //导入依赖的package包/类
@ParameterizedTest
@ValueSource(strings = "SECONDS")
void testWithImplicitConversionToEnum(TimeUnit argument) {
System.out.println("Argument " + argument + " is a type of "
+ argument.getDeclaringClass());
assertNotNull(argument.name());
}
示例9: testWithImplicitConversionToLocalDate
import org.junit.jupiter.params.provider.ValueSource; //导入依赖的package包/类
@ParameterizedTest
@ValueSource(strings = "2017-07-25")
void testWithImplicitConversionToLocalDate(LocalDate argument) {
System.out.println("Argument " + argument + " is a type of "
+ argument.getClass());
assertNotNull(argument);
}
示例10: anySuperclass
import org.junit.jupiter.params.provider.ValueSource; //导入依赖的package包/类
@ParameterizedTest
@ValueSource(strings = {
"java.util.List",
"java.util.Collection",
"java.lang.Object",
})
void anySuperclass(
@ConvertWith(ClassArgumentConverter.class) Class<? super List<?>> superclassOfList) {
assertThat(superclassOfList).isNotNull();
}
示例11: anySubclass
import org.junit.jupiter.params.provider.ValueSource; //导入依赖的package包/类
@ParameterizedTest
@ValueSource(strings = {
"java.util.List",
"java.util.ArrayList",
})
void anySubclass(@ConvertWith(ClassArgumentConverter.class) Class<? extends List<?>> anything) {
assertThat(anything).isNotNull();
}
示例12: classNotFound
import org.junit.jupiter.params.provider.ValueSource; //导入依赖的package包/类
@ExpectFailure({
@Cause(type = ParameterResolutionException.class),
@Cause(type = ArgumentConversionException.class),
@Cause(type = ClassNotFoundException.class)
})
@ParameterizedTest
@ValueSource(strings = "123ClassDoesNotExist")
void classNotFound(@ConvertWith(ClassArgumentConverter.class) Class<?> clazz) {}
示例13: badParameterType
import org.junit.jupiter.params.provider.ValueSource; //导入依赖的package包/类
@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) {}
示例14: wrongClass
import org.junit.jupiter.params.provider.ValueSource; //导入依赖的package包/类
@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) {}
示例15: badLowerBound
import org.junit.jupiter.params.provider.ValueSource; //导入依赖的package包/类
@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) {}