本文整理汇总了Java中org.junit.jupiter.params.ParameterizedTest类的典型用法代码示例。如果您正苦于以下问题:Java ParameterizedTest类的具体用法?Java ParameterizedTest怎么用?Java ParameterizedTest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParameterizedTest类属于org.junit.jupiter.params包,在下文中一共展示了ParameterizedTest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildConditions
import org.junit.jupiter.params.ParameterizedTest; //导入依赖的package包/类
@ParameterizedTest
@MethodSource("goodMapConditionAndResult")
void buildConditions(final Map<String, String> params, final List<FilterValue> filterValues, final Condition expectedCondition) {
filteringJooqImpl1.getFilterValues().addAll(filterValues);
final Condition condition = filteringJooqImpl1.buildConditions(params);
Assertions.assertEquals(expectedCondition, condition);
}
示例2: timerLineProtocol
import org.junit.jupiter.params.ParameterizedTest; //导入依赖的package包/类
@ParameterizedTest
@EnumSource(StatsdFlavor.class)
void timerLineProtocol(StatsdFlavor flavor) {
String line = null;
switch (flavor) {
case Etsy:
line = "myTimer.myTag.val:1|ms";
break;
case Datadog:
line = "my.timer:1|ms|#my.tag:val";
break;
case Telegraf:
line = "my_timer,my_tag=val:1|ms";
}
assertLines(r -> r.timer("my.timer", "my.tag", "val").record(1, TimeUnit.MILLISECONDS),
flavor, line);
}
示例3: testCpcPlusFileSuccesses
import org.junit.jupiter.params.ParameterizedTest; //导入依赖的package包/类
@ParameterizedTest
@MethodSource("successData")
void testCpcPlusFileSuccesses(Path entry) throws IOException {
AllErrors errors = null;
Converter converter = new Converter(new PathSource(entry));
try {
converter.transform();
} catch (TransformException failure) {
errors = failure.getDetails();
}
assertThat(errors).isNull();
}
示例4: testPresetStrings
import org.junit.jupiter.params.ParameterizedTest; //导入依赖的package包/类
@ParameterizedTest
@EnumSource(Color.Preset.class)
void testPresetStrings(Color.Preset preset) {
Color color = Color.of(preset.toString());
assertValid(color);
assertTrue(color.isPreset());
assertThat(color.asPreset(), is(equalTo(preset)));
}
示例5: testWithStrings
import org.junit.jupiter.params.ParameterizedTest; //导入依赖的package包/类
@ParameterizedTest
@ValueSource(strings = { "Hello", "World" })
void testWithStrings(String argument) {
System.out.println(
"Parameterized test with (String) parameter: " + argument);
assertNotNull(argument);
}
示例6: testWithLongs
import org.junit.jupiter.params.ParameterizedTest; //导入依赖的package包/类
@ParameterizedTest
@ValueSource(longs = { 2L, 3L })
void testWithLongs(long argument) {
System.out.println(
"Parameterized test with (long) argument: " + argument);
assertNotNull(argument);
}
开发者ID:PacktPublishing,项目名称:Mastering-Software-Testing-with-JUnit-5,代码行数:8,代码来源:ValueSourcePrimitiveTypesParameterizedTest.java
示例7: testWithExcludeEnum
import org.junit.jupiter.params.ParameterizedTest; //导入依赖的package包/类
@ParameterizedTest
@EnumSource(value = TimeUnit.class, mode = EXCLUDE, names = { "DAYS",
"HOURS" })
void testWithExcludeEnum(TimeUnit argument) {
System.out.println(
"Parameterized test with excluded (TimeUnit) argument: "
+ argument);
assertNotNull(argument);
}
示例8: serializesToSc2ApiUnitSelectionPointType
import org.junit.jupiter.params.ParameterizedTest; //导入依赖的package包/类
@ParameterizedTest(name = "\"{0}\" is serialization of {1}")
@MethodSource(value = "unitSelectionPointTypeMappings")
void serializesToSc2ApiUnitSelectionPointType(
Spatial.ActionSpatialUnitSelectionPoint.Type expectedSc2ApiSelectionPointType,
ActionSpatialUnitSelectionPoint.Type selectionPointType) {
assertThat(selectionPointType.toSc2Api()).isEqualTo(expectedSc2ApiSelectionPointType);
}
示例9: serializesToSc2ApiControlGroupAction
import org.junit.jupiter.params.ParameterizedTest; //导入依赖的package包/类
@ParameterizedTest(name = "\"{0}\" is serialization of {1}")
@MethodSource(value = "controlGroupActionMappings")
void serializesToSc2ApiControlGroupAction(
Ui.ActionControlGroup.ControlGroupAction expectedSc2ApiControlGroupAction,
ActionUiControlGroup.Action controlGroupAction) {
assertThat(controlGroupAction.toSc2Api()).isEqualTo(expectedSc2ApiControlGroupAction);
}
示例10: testWithArgumentsSource
import org.junit.jupiter.params.ParameterizedTest; //导入依赖的package包/类
@ParameterizedTest
@ArgumentsSources({ @ArgumentsSource(CustomArgumentsProvider1.class),
@ArgumentsSource(CustomArgumentsProvider2.class) })
void testWithArgumentsSource(String first, int second) {
System.out.println("Parameterized test with (String) " + first
+ " and (int) " + second);
assertNotNull(first);
assertTrue(second > 0);
}
示例11: testWithLongProvider
import org.junit.jupiter.params.ParameterizedTest; //导入依赖的package包/类
@ParameterizedTest
@MethodSource("longProvider")
void testWithLongProvider(long argument) {
System.out.println(
"Parameterized test with (long) argument: " + argument);
assertNotNull(argument);
}
示例12: testWithStringProvider
import org.junit.jupiter.params.ParameterizedTest; //导入依赖的package包/类
@ParameterizedTest
@MethodSource("stringProvider")
void testWithStringProvider(String argument) {
System.out.println(
"Parameterized test with (String) argument: " + argument);
assertNotNull(argument);
}
开发者ID:PacktPublishing,项目名称:Mastering-Software-Testing-with-JUnit-5,代码行数:8,代码来源:MethodSourceStringsParameterizedTest.java
示例13: testWithDoubles
import org.junit.jupiter.params.ParameterizedTest; //导入依赖的package包/类
@ParameterizedTest
@ValueSource(doubles = { 4d, 5d })
void testWithDoubles(double argument) {
System.out.println(
"Parameterized test with (double) argument: " + argument);
assertNotNull(argument);
}
开发者ID:PacktPublishing,项目名称:Mastering-Software-Testing-with-JUnit-5,代码行数:8,代码来源:ValueSourcePrimitiveTypesParameterizedTest.java
示例14: testWithImplicitConversionToEnum
import org.junit.jupiter.params.ParameterizedTest; //导入依赖的package包/类
@ParameterizedTest
@ValueSource(strings = "SECONDS")
void testWithImplicitConversionToEnum(TimeUnit argument) {
System.out.println("Argument " + argument + " is a type of "
+ argument.getDeclaringClass());
assertNotNull(argument.name());
}
示例15: testWithRegexEnum
import org.junit.jupiter.params.ParameterizedTest; //导入依赖的package包/类
@ParameterizedTest
@EnumSource(value = TimeUnit.class, mode = MATCH_ALL, names = "^(M|N).+SECONDS$")
void testWithRegexEnum(TimeUnit argument) {
System.out.println(
"Parameterized test with regex filtered (TimeUnit) argument: "
+ argument);
assertNotNull(argument);
}
开发者ID:PacktPublishing,项目名称:Mastering-Software-Testing-with-JUnit-5,代码行数:9,代码来源:EnumSourceFilteringParameterizedTest.java