类org.junit.jupiter.params.provider.CsvFileSource源码实例Demo

下面列出了怎么用org.junit.jupiter.params.provider.CsvFileSource的API类实例代码及写法,或者点击链接到github查看源代码。

@ParameterizedTest
@CsvFileSource(resources = "/input.csv")
void testWithCsvFileSource(String first, int second) {
    System.out.println("Yet another parameterized test with (String) "
            + first + " and (int) " + second);

    assertNotNull(first);
    assertNotEquals(0, second);
}
 
@ParameterizedTest
@CsvFileSource(resources = "/input.csv")
void testWithCsvFileSource(String first, int second) {
    System.out.println("Yet another parameterized test with (String) "
            + first + " and (int) " + second);

    assertNotNull(first);
    assertNotEquals(0, second);
}
 
源代码3 项目: jpeek   文件: Lcom4Test.java
@ParameterizedTest
@Disabled
@CsvFileSource(resources = "/org/jpeek/calculus/java/lcom4-params.csv")
public void calculatesValue(final String file, final String value) throws Exception {
    final XML result = new Lcom4().node(
        "", new HashMap<>(0), new Skeleton(
            new FakeBase(file)
        ).xml()
    );
    new Assertion<>(
        "Must create LCOM4 value",
        new ItemAt<>(0, result.xpath("/metric/app/package/class/@value")),
        new ScalarHasValue<>(value)
    ).affirm();
}
 
源代码4 项目: jpeek   文件: MetricsTest.java
@ParameterizedTest
@CsvFileSource(resources = "/org/jpeek/metricstest-params.csv")
public void testsTarget(final String target, final String metric, final double value,
    @TempDir final Path output)
    throws Exception {
    new XslReport(
        new Skeleton(new FakeBase(target)).xml(), new XslCalculus(),
        new ReportData(metric)
    ).save(output);
    final String xpath;
    if (Double.isNaN(value)) {
        xpath = "//class[@id='%s' and @value='NaN']";
    } else {
        xpath = "//class[@id='%s' and number(@value)=%.4f]";
    }
    new Assertion<>(
        new FormattedText(
            "Must exists with target '%s' and value '%s'",
            target, value
        ).asString(),
        XhtmlMatchers.xhtml(
            new TextOf(
                output.resolve(String.format("%s.xml", metric))
            ).asString()
        ),
        XhtmlMatchers.hasXPaths(
            String.format(
                xpath,
                target, value
            )
        )
    ).affirm();
}
 
源代码5 项目: triplea   文件: RemoteActionCodeTest.java
@ParameterizedTest
@CsvFileSource(resources = "/required-op-codes.csv")
void verifyCorrectOpCode(
    final int opCode, @AggregateWith(MethodAggregator.class) final Method method) {
  final RemoteActionCode remoteActionCode = method.getAnnotation(RemoteActionCode.class);

  assertThat(
      "Expected @RemoteActionCode annotation to be present for " + method,
      remoteActionCode,
      is(notNullValue()));

  assertThat("Invalid value for " + method, remoteActionCode.value(), is(opCode));
}
 
源代码6 项目: greenbot   文件: DevTagAnalyzerTest.java
@ParameterizedTest
@CsvFileSource(resources = "/dev-tags.csv")
void withCsvSource(String key, String value, Boolean outcome) {
    Tag tag = Tag.builder().key(key).value(value).build();
    assertEquals(outcome, devTagAnalyzer.isDevTagPresent(Arrays.asList(tag)));
}
 
源代码7 项目: journaldev   文件: ParameterizedTests.java
@ParameterizedTest
@CsvFileSource(resources = "/country_code.csv", numLinesToSkip = 1)
void test_CsvFileSource(String country, int code) {
    assertNotNull(country);
    assertTrue(0 < code);
}
 
源代码8 项目: demo-junit-5   文件: ArgumentSourcesTest.java
@ParameterizedTest
@CsvFileSource(resources = "/word-lengths.csv")
void withCsvFileSource(String word, int length) {
	assertEquals(length, word.length());
}
 
源代码9 项目: crawler-commons   文件: BasicURLNormalizerTest.java
@ParameterizedTest
@CsvFileSource(resources = "/normalizer/weirdToNormalizedUrls.csv")
void testBasicNormalizer(String weirdUrl, String expectedNormalizedUrl) throws Exception {
  Assertions.assertEquals(expectedNormalizedUrl, normalizer.filter(weirdUrl), "normalizing: " + weirdUrl);
}
 
 类所在包
 同包方法