當前位置: 首頁>>代碼示例>>Java>>正文


Java ParameterizedTest類代碼示例

本文整理匯總了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);
}
 
開發者ID:Blackdread,項目名稱:filter-sort-jooq-api,代碼行數:8,代碼來源:FilteringJooqTest.java

示例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);
}
 
開發者ID:micrometer-metrics,項目名稱:micrometer,代碼行數:19,代碼來源:StatsdMeterRegistryTest.java

示例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();
}
 
開發者ID:CMSgov,項目名稱:qpp-conversion-tool,代碼行數:16,代碼來源:CpcPlusAcceptanceTest.java

示例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)));
}
 
開發者ID:palantir,項目名稱:roboslack,代碼行數:9,代碼來源:ColorTests.java

示例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);
}
 
開發者ID:bonigarcia,項目名稱:mastering-junit5,代碼行數:8,代碼來源:ValueSourceStringsParameterizedTest.java

示例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);
}
 
開發者ID:bonigarcia,項目名稱:mastering-junit5,代碼行數:10,代碼來源:EnumSourceFilteringParameterizedTest.java

示例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);
}
 
開發者ID:ocraft,項目名稱:ocraft-s2client,代碼行數:8,代碼來源:ActionSpatialUnitSelectionPointTest.java

示例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);
}
 
開發者ID:ocraft,項目名稱:ocraft-s2client,代碼行數:8,代碼來源:ActionUiControlGroupTest.java

示例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);
}
 
開發者ID:bonigarcia,項目名稱:mastering-junit5,代碼行數:11,代碼來源:ArgumentSourcesParameterizedTest.java

示例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);
}
 
開發者ID:bonigarcia,項目名稱:mastering-junit5,代碼行數:8,代碼來源:MethodSourcePrimitiveTypesParameterizedTest.java

示例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());
}
 
開發者ID:bonigarcia,項目名稱:mastering-junit5,代碼行數:8,代碼來源:ImplicitConversionParameterizedTest.java

示例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


注:本文中的org.junit.jupiter.params.ParameterizedTest類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。