当前位置: 首页>>代码示例>>Java>>正文


Java CsvSource类代码示例

本文整理汇总了Java中org.junit.jupiter.params.provider.CsvSource的典型用法代码示例。如果您正苦于以下问题:Java CsvSource类的具体用法?Java CsvSource怎么用?Java CsvSource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CsvSource类属于org.junit.jupiter.params.provider包,在下文中一共展示了CsvSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isMetaDataTest

import org.junit.jupiter.params.provider.CsvSource; //导入依赖的package包/类
@ParameterizedTest
@CsvSource({"false, /key",
               "false, /metadata",
               "false, /~metadata",
               "false, /metadata~",
               "true, /~metadata~",
               "false, /METADATA",
               "false, /~METADATA",
               "false, /METADATA~",
               "true, /~METADATA~",
               "true, /.metadata",
               "true, /~METADATA~/someOtherValue",
               "true, /.metadata/someOtherValue",
               "false, /my.key.with.dots",
               "false, /my~key~with~tildes~",
               "false, /~my~keywithtildes",
               "false, /~metadata~with~tildes~"})
public void isMetaDataTest(boolean expectedResult, String key) {
  assertEquals(expectedResult, NetworkTableUtils.isMetadata(key));
}
 
开发者ID:wpilibsuite,项目名称:shuffleboard,代码行数:21,代码来源:NetworkTableUtilsTest.java

示例2: findPrimeNumbers

import org.junit.jupiter.params.provider.CsvSource; //导入依赖的package包/类
@ParameterizedTest(name = "{0} should be prime? {1}")
@CsvSource({
		"1, false",
		"2, true",
		"3, true",
		"4, false",
		"5, true",
		"6, false",
		"7, true",
		"8, false",
		"9, false",
		"10, false",
		"2147483647, true" })
public void findPrimeNumbers(long n, boolean isPrime)
{
	assertThat(sut.isPrime(n)).isEqualTo(isPrime);
}
 
开发者ID:StefanMacke,项目名称:pbt-junit-quickcheck,代码行数:18,代码来源:PrimeFactorCalculatorShould.java

示例3: process

import org.junit.jupiter.params.provider.CsvSource; //导入依赖的package包/类
@ParameterizedTest
@CsvSource({"true, true, true, 1, 1, 0", "true, true, false, 1, 0, 0", "true, false, true, 0, 0, 1", "false, true, true, 0, 0, 1"})
void process(boolean origin, boolean target, boolean orientate, int times, int orientateTimes, int done) {
    doNothing().when(task).orientate();
    doNothing().when(task).render();
    doReturn(origin).when(this.origin).validate();
    doReturn(target).when(this.target).validate();
    
    task.orientate = orientate;
    
    task.process();
    
    verify(this.origin, times(times)).update();
    verify(this.target, times(times)).update();
    verify(task, times(orientateTimes)).orientate();
    verify(task, times(times)).render();
    verify(runnable, times(done)).run();
}
 
开发者ID:Pante,项目名称:Karus-Commons,代码行数:19,代码来源:TaskTest.java

示例4: render

import org.junit.jupiter.params.provider.CsvSource; //导入依赖的package包/类
@ParameterizedTest
@CsvSource({"1, 0", "0, 1"})
void render(int steps, int times) {
    context.steps = steps;
    doNothing().when(wave).process(origin);
    
    Vector water = new Vector(0, 0, 1);
    Vector cloud = new Vector(0, 0, 2);
    
    wave.waters.add(water);
    wave.clouds.add(cloud);
    
    
    wave.render(context, origin, target, offset);
    
    verify(wave, times(times)).process(origin);
    verify(context).render(PARTICLES, origin, water);
    verify(context).render(COLOURED, origin, cloud);
}
 
开发者ID:Pante,项目名称:Karus-Commons,代码行数:20,代码来源:WaveTest.java

示例5: testMajorMinorVersion

import org.junit.jupiter.params.provider.CsvSource; //导入依赖的package包/类
@ParameterizedTest
@CsvSource({
	"01, 		1, 0, 0",
	"1, 		1, 0, 0",
	"1.0, 		1, 0, 0",
	"1.0.0,		1, 0, 0",
	"1.2, 		1, 2, 0",
	"1.2.3, 	1, 2, 3",
	"1.2.3, 	1, 2, 3",
	"1.2.3.4, 	1, 2, 3",
})
public void testMajorMinorVersion(String versionString, int major, int minor, int bugfix) {
	assertEquals(major, new Version(versionString).getMajor());
	assertEquals(minor, new Version(versionString).getMinor());
	assertEquals(bugfix, new Version(versionString).getBugfix());
}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:17,代码来源:VersionTest.java

示例6: testCompare

import org.junit.jupiter.params.provider.CsvSource; //导入依赖的package包/类
@ParameterizedTest
@CsvSource({
	"01, 		1, 		0",
	"1, 		1, 		0",
	"1.0, 		1, 		0",
	"1.0.0,		1, 		0",
	"1.0, 		1.0, 	0",
	"1.0.0,		1.0.0, 	0",
	"1.2, 		1, 		1",
	"1.2, 		1.3, 	-1",
	"1.2.3, 	1, 		1",
	"1.2.3.4, 	1, 		1",
	"1.3.1, 	1.3,	1",
	"1.2.3, 	1.3,	-1",
	"1.2.3.4, 	1.3, 	-1",
	"1.3.1, 	1.3.2, 	-1",
	"1.3.2, 	1.3.2.1,-1",
	"9.9.9.9,	10.0.0, -1",
	"9.20.20,	10.0.0, -1",
})
public void testCompare(String version1, String version2, int resultSignum) {
	assertEquals(Integer.signum(new Version(version1).compareTo(new Version(version2))), resultSignum);
}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:24,代码来源:VersionTest.java

示例7: isAtLeast

import org.junit.jupiter.params.provider.CsvSource; //导入依赖的package包/类
@ParameterizedTest
@CsvSource({
	"JRE_VERSION_9,   JRE_VERSION_160, true",
	"JRE_VERSION_9,   JRE_VERSION_170, true",
	"JRE_VERSION_9,   JRE_VERSION_180, true",
	"JRE_VERSION_9,   JRE_VERSION_9,   true",
	"JRE_VERSION_180, JRE_VERSION_160, true",
	"JRE_VERSION_180, JRE_VERSION_170, true",
	"JRE_VERSION_180, JRE_VERSION_180, true",
	"JRE_VERSION_170, JRE_VERSION_160, true",
	"JRE_VERSION_170, JRE_VERSION_170, true",
	"JRE_VERSION_180, JRE_VERSION_9,   false",
	"JRE_VERSION_170, JRE_VERSION_180, false",
	"JRE_VERSION_170, JRE_VERSION_9,   false",
})
public void isAtLeast(@ConvertWith(JavaVersionConstantArgumentConverter.class) JavaVersion version1,
		@ConvertWith(JavaVersionConstantArgumentConverter.class) JavaVersion version2, boolean result) {
	assertEquals(version1.isAtLeast(version2), result);
}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:20,代码来源:JavaVersionTest.java

示例8: isBelow

import org.junit.jupiter.params.provider.CsvSource; //导入依赖的package包/类
@ParameterizedTest
@CsvSource({
	"JRE_VERSION_160, JRE_VERSION_170, true",
	"JRE_VERSION_170, JRE_VERSION_180, true",
	"JRE_VERSION_180, JRE_VERSION_9,   true",
	"JRE_VERSION_9,   JRE_VERSION_180, false",
	"JRE_VERSION_170, JRE_VERSION_160, false",
	"JRE_VERSION_170, JRE_VERSION_170, false",
	"JRE_VERSION_180, JRE_VERSION_160, false",
	"JRE_VERSION_180, JRE_VERSION_170, false",
	"JRE_VERSION_180, JRE_VERSION_180, false",
})
public void isBelow(@ConvertWith(JavaVersionConstantArgumentConverter.class) JavaVersion version1,
		@ConvertWith(JavaVersionConstantArgumentConverter.class) JavaVersion version2, boolean result) {
	assertEquals(version1.isBelow(version2), result);
}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:17,代码来源:JavaVersionTest.java

示例9: ripemd160RsaSpkac

import org.junit.jupiter.params.provider.CsvSource; //导入依赖的package包/类
@ParameterizedTest
@CsvSource({
	"MD2_RSA",
	"MD5_RSA",
	"RIPEMD128_RSA",
	"RIPEMD160_RSA",
	"RIPEMD256_RSA",
	"SHA1_RSA",
	"SHA224_RSA",
	"SHA256_RSA",
	"SHA384_RSA",
	"SHA512_RSA",
	"SHA1_DSA",
	"SHA224_DSA",
	"SHA256_DSA",
})
public void ripemd160RsaSpkac(SignatureType signatureAlgorithm) throws Exception {

	if (signatureAlgorithm.name().endsWith("_RSA")) {
		doTestSpkac(rsaKeyPair, signatureAlgorithm);
	} else {
		doTestSpkac(dsaKeyPair, signatureAlgorithm);
	}
}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:25,代码来源:SpkacTest.java

示例10: testMessageDigests

import org.junit.jupiter.params.provider.CsvSource; //导入依赖的package包/类
@ParameterizedTest
@CsvSource({
	"MD2",
	"MD4",
	"MD5",
	"SHA1",
	"SHA224",
	"SHA256",
	"SHA384",
	"SHA512",
	"RIPEMD128",
	"RIPEMD160",
	"RIPEMD256",
})
public void testMessageDigests(DigestType digestType) throws Exception {
	String digest = DigestUtil.getFriendlyMessageDigest(MESSAGE.getBytes(), digestType);
	assertTrue(!digest.equals(MESSAGE));
}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:19,代码来源:DigestUtilTest.java

示例11: doTests

import org.junit.jupiter.params.provider.CsvSource; //导入依赖的package包/类
@ParameterizedTest
@CsvSource({
	"DSA, 512",
	"DSA, 1024",
	"RSA, 512",
	"RSA, 1024",
	"RSA, 2048",
	//"RSA, 3072", takes too long
	//"RSA, 4096", takes too long
})
public void doTests(KeyPairType keyPairType, Integer keySize) throws Exception {
	KeyPair keyPair = KeyPairUtil.generateKeyPair(keyPairType, keySize, new BouncyCastleProvider());

	PrivateKey privateKey = keyPair.getPrivate();
	KeyInfo privateKeyInfo = KeyPairUtil.getKeyInfo(privateKey);
	assertEquals(keyPairType.toString(), privateKeyInfo.getAlgorithm());
	assertEquals(keySize, privateKeyInfo.getSize());

	PublicKey publicKey = keyPair.getPublic();
	KeyInfo publicKeyInfo = KeyPairUtil.getKeyInfo(publicKey);
	assertEquals(keyPairType.toString(), publicKeyInfo.getAlgorithm());
	assertEquals(keySize, publicKeyInfo.getSize());

	assertTrue(KeyPairUtil.validKeyPair(privateKey, publicKey));
}
 
开发者ID:kaikramer,项目名称:keystore-explorer,代码行数:26,代码来源:KeyPairUtilTest.java

示例12: testWithCustomDisplayNames

import org.junit.jupiter.params.provider.CsvSource; //导入依赖的package包/类
@DisplayName("Display name of test container")
@ParameterizedTest(name = "[{index}] first argument=\"{0}\", second argument={1}")
@CsvSource({ "mastering, 1", "parameterized, 2", "tests, 3" })
void testWithCustomDisplayNames(String first, int second) {
    System.out.println(
            "Testing with parameters: " + first + " and " + second);
}
 
开发者ID:bonigarcia,项目名称:mastering-junit5,代码行数:8,代码来源:CustomNamesParameterizedTest.java

示例13: testWithCsvSource

import org.junit.jupiter.params.provider.CsvSource; //导入依赖的package包/类
@ParameterizedTest
@CsvSource({ "hello, 1", "world, 2", "'happy, testing', 3" })
void testWithCsvSource(String first, int second) {
    System.out.println("Parameterized test with (String) " + first
            + " and (int) " + second);

    assertNotNull(first);
    assertNotEquals(0, second);
}
 
开发者ID:bonigarcia,项目名称:mastering-junit5,代码行数:10,代码来源:CsvSourceParameterizedTest.java

示例14: verboseMode_instrumentation

import org.junit.jupiter.params.provider.CsvSource; //导入依赖的package包/类
@ParameterizedTest
@CsvSource(value = { "true", "false" })
public void verboseMode_instrumentation(boolean verbose) {
    settingsBuilder.withVerboseMode(verbose);
    String testSource = String.format(
            "package %s;\n" +
            "\n" +
            "import %s;\n" +
            "\n" +
            "public class %s {\n" +
            "\n" +
            "  @NotNull\n" +
            "  public Integer test(@NotNull Integer i1, @NotNull Integer i2) {\n" +
            "    return i1 + i2;\n" +
            "  }\n" +
            "\n" +
            "  @NotNull\n" +
            "  private Integer negative(@NotNull Integer i) {\n" +
            "      return -1 * i;\n" +
            "  }\n" +
            "\n" +
            "  public static void main(String[] args) {\n" +
            "    new Test().test(1, 2);\n" +
            "  }\n" +
            "}", PACKAGE, NotNull.class.getName(), CLASS_NAME);

    String[] targetParameterNames = {"i1", "i2", "i"};
    for (String name : targetParameterNames) {
        expectCompilationResult.withText(String.format("added a null-check for argument '%s'", name), verbose);
    }

    String methodPrefix = PACKAGE + "." + CLASS_NAME + ".";
    String[] targetMethods = {methodPrefix + "test()", methodPrefix + "negative()"};
    for (String method : targetMethods) {
        expectCompilationResult.withText("added a null-check for 'return' expression in method " + method,
                                         verbose);
    }

    doTest(testSource);
}
 
开发者ID:denis-zhdanov,项目名称:traute,代码行数:41,代码来源:LoggingTest.java

示例15: multipleArguments

import org.junit.jupiter.params.provider.CsvSource; //导入依赖的package包/类
@ParameterizedTest
@CsvSource(delimiter = ':', value = {
        "null, 1:i1:0", "1, null:i2:0"
})
public void multipleArguments(@NotNull String callArguments, @NotNull String parameterName) {
    String testSource = prepareParameterTestSource(
            NotNull.class.getName(),
            String.format("public void %s(@NotNull Integer i1,\n                   @NotNull Integer i2) {}",
                          METHOD_NAME),
            callArguments
    );
    expectNpeFromParameterCheck(testSource, parameterName, expectRunResult);
    doTest(testSource);
}
 
开发者ID:denis-zhdanov,项目名称:traute,代码行数:15,代码来源:MethodParameterTest.java


注:本文中的org.junit.jupiter.params.provider.CsvSource类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。