Java 类org.junit.runners.Parameterized 实例源码

项目:hadoop    文件:TestServerConstructor.java   
@Parameterized.Parameters
public static Collection constructorFailParams() {
  return Arrays.asList(new Object[][]{
    {null, null, null, null, null, null},
    {"", null, null, null, null, null},
    {null, null, null, null, null, null},
    {"server", null, null, null, null, null},
    {"server", "", null, null, null, null},
    {"server", "foo", null, null, null, null},
    {"server", "/tmp", null, null, null, null},
    {"server", "/tmp", "", null, null, null},
    {"server", "/tmp", "foo", null, null, null},
    {"server", "/tmp", "/tmp", null, null, null},
    {"server", "/tmp", "/tmp", "", null, null},
    {"server", "/tmp", "/tmp", "foo", null, null},
    {"server", "/tmp", "/tmp", "/tmp", null, null},
    {"server", "/tmp", "/tmp", "/tmp", "", null},
    {"server", "/tmp", "/tmp", "/tmp", "foo", null}});
}
项目:annotation-processor-toolkit    文件:FileObjectUtilsTest.java   
@Parameterized.Parameters(name = "{index}: \"{0}\"")
public static List<Object[]> data() {

    return Arrays.asList(new Object[][]{
            {
                    "Test valid usage",
                    AnnotationProcessorIntegrationTestConfigurationBuilder.createTestConfig()
                            .setSourceFileToCompile("testcases/generators/FileObjectUtilsTestClass.java")
                            .compilationShouldSucceed()
                            .resourceShouldMatch(JavaFileObjects.forResource("testcases/generators/expectedResult.txt"))
                            .build()
            },


    });

}
项目:syndesis    文件:DefaultProjectGeneratorTest.java   
@Parameterized.Parameters
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[][] {
        {
            "",
            Collections.emptyList()
        },
        {
            "redhat",
            Arrays.asList(
                new Templates.Resource("deployment.yml", "src/main/fabric8/deployment.yml"),
                new Templates.Resource("settings.xml", "configuration/settings.xml")
            )
        }
    });
}
项目:tinkergraph-gremlin    文件:TinkerGraphCountStrategyTest.java   
@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> generateTestParameters() {
    return Arrays.asList(new Object[][]{
            {__.V().count(), countStep(Vertex.class), Collections.emptyList()},
            {__.V().count(), countStep(Vertex.class), TraversalStrategies.GlobalCache.getStrategies(TinkerGraph.class).toList()},
            {__.V().as("a").count(), countStep(Vertex.class), TraversalStrategies.GlobalCache.getStrategies(TinkerGraph.class).toList()},
            {__.V().count().as("a"), countStep(Vertex.class), TraversalStrategies.GlobalCache.getStrategies(TinkerGraph.class).toList()},
            {__.V().map(out()).count().as("a"), countStep(Vertex.class), TraversalStrategies.GlobalCache.getStrategies(TinkerGraph.class).toList()},
            {__.V().map(out()).identity().count().as("a"), countStep(Vertex.class), TraversalStrategies.GlobalCache.getStrategies(TinkerGraph.class).toList()},
            {__.V().map(out().groupCount()).identity().count().as("a"), countStep(Vertex.class), TraversalStrategies.GlobalCache.getStrategies(TinkerGraph.class).toList()},
            {__.V().label().map(s -> s.get().length()).count(), countStep(Vertex.class), TraversalStrategies.GlobalCache.getStrategies(TinkerGraph.class).toList()},
            {__.V().as("a").map(select("a")).count(), countStep(Vertex.class),TraversalStrategies.GlobalCache.getStrategies(TinkerGraph.class).toList()},
            //
            {__.V(), __.V(), Collections.emptyList()},
            {__.V().out().count(), __.V().out().count(), Collections.emptyList()},
            {__.V(1).count(), __.V(1).count(), Collections.emptyList()},
            {__.count(), __.count(), Collections.emptyList()},
            {__.V().map(out().groupCount("m")).identity().count().as("a"), __.V().map(out().groupCount("m")).identity().count().as("a"), Collections.emptyList()},
    });
}
项目:sling-org-apache-sling-testing-rules    文件:FilterRuleAsteriskMatchTest.java   
@Parameterized.Parameters
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[][] {
            {"a.b.c", "a.b.c", true},
            {"a.b.c.*", "a.b.c.d", true},
            {"*.c", "a.b.c", true},
            {"*", "a.b.c.MyTest", true},
            {"*.MyTest", "a.b.c.MyTest", true},
            {"a.b.*.c", "a.b.x.y.c", true},
            {"a.b.*.c.*", "a.b.x.y.c.MyTest", true},

            {"a.b.*.c", "a.b.x.y.c.NotMyTest", false},
            {"*.MyTest", "a.b.c.NotMyTest", false},
            {"*.c", "a.b.c.d", false},
            {"a.b.c", "x", false},
            {"", "x", false},
    });
}
项目:cas4.0.x-server-wechat    文件:RegisteredServiceImplTests.java   
@Parameterized.Parameters
public static Collection<Object[]> getParameters() {
    return Arrays.asList(new Object[][]{
            // Allow all paths on single host
            {
                    newService("https://host.vt.edu/**"),
                    "https://host.vt.edu/a/b/c?a=1&b=2",
                    true,
            },
            // Global catch-all for HTTP
            {
                    newService("http://**"),
                    "http://host.subdomain.example.com/service",
                    true,
            },
            // Null case
            {
                    newService("https:/example.com/**"),
                    null,
                    false,
            },
    });
}
项目:springboot-shiro-cas-mybatis    文件:RegisteredServiceImplTests.java   
@Parameterized.Parameters
public static Collection<Object[]> getParameters() {
    return Arrays.asList(new Object[][]{
            // Allow all paths on single host
            {
                    newService("https://host.vt.edu/**"),
                    "https://host.vt.edu/a/b/c?a=1&b=2",
                    true,
            },
            // Global catch-all for HTTP
            {
                    newService("http://**"),
                    "http://host.subdomain.example.com/service",
                    true,
            },
            // Null case
            {
                    newService("https:/example.com/**"),
                    null,
                    false,
            },
    });
}
项目:springboot-shiro-cas-mybatis    文件:RegisteredServiceImplTests.java   
@Parameterized.Parameters
public static Collection<Object[]> getParameters() {
    return Arrays.asList(new Object[][]{
            // Allow all paths on single host
            {
                    newService("https://host.vt.edu/**"),
                    "https://host.vt.edu/a/b/c?a=1&b=2",
                    true,
            },
            // Global catch-all for HTTP
            {
                    newService("http://**"),
                    "http://host.subdomain.example.com/service",
                    true,
            },
            // Null case
            {
                    newService("https:/example.com/**"),
                    null,
                    false,
            },
    });
}
项目:smart-testing    文件:StrategiesComparatorTest.java   
@Parameterized.Parameters
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[][] {
        { strategiesListOf("a", "c", "d", "e", "b"), strategiesListOf("a", "b", "c", "d", "e") },
        { strategiesListOf("d,e", "b,c,d", "a,b,d", "a", "a,c"), strategiesListOf("a,b,d", "a,c", "a", "b,c,d", "d,e") },
        { strategiesListOf("a,c,d", "a,c,e", "a,c,d,e", "a,b", "a,b,c,d,e"), strategiesListOf("a,b,c,d,e", "a,b", "a,c,d,e", "a,c,d", "a,c,e") },
        { strategiesListOf("b,c,d", "a", "b", "b,c,d,e", "c,d,e"), strategiesListOf("a", "b,c,d,e", "b,c,d", "b", "c,d,e") },
        { strategiesListOf("e", "c", "c,e", "a,d,e", "a,e"), strategiesListOf("a,d,e", "a,e", "c,e", "c", "e") },
        { strategiesListOf("b,d", "a,d", "d,e", "c", "b"), strategiesListOf("a,d", "b,d", "b", "c", "d,e") },
        { strategiesListOf("a,c,e", "a,c", "a,c,d", "a,b", "b,c"), strategiesListOf("a,b", "a,c,d", "a,c,e", "a,c", "b,c") },
        { strategiesListOf("c,e", "a,b", "a", "b"), strategiesListOf("a,b", "a", "b", "c,e") },
        { strategiesListOf("b,a", "e,a", "a,e", "a,b"), strategiesListOf("b,a", "a,b", "e,a", "a,e") },
        { strategiesListOf("a,b,d", "a", "a,d,b", "a,b"), strategiesListOf("a,b,d", "a,d,b", "a,b", "a") },
        { strategiesListOf("e", "d", "e,c", "e,d"), strategiesListOf("e,c", "e,d", "d", "e") },
        { strategiesListOf("c,d,e", "d,e,c", "d,c,e"), strategiesListOf("c,d,e", "d,e,c", "d,c,e") },
        { strategiesListOf("c,e", "e,d", "a"), strategiesListOf("a", "c,e", "e,d") },
        { strategiesListOf("b,c,d,e", "a"), strategiesListOf("a", "b,c,d,e") },
    });
}
项目:annotation-processor-toolkit    文件:MethodWithOneStringParameterAndVoidReturnTypeProcessorTest.java   
@Parameterized.Parameters(name = "{index}: \"{0}\"")
public static List<Object[]> data() {

    return Arrays.asList(new Object[][]{
            {
                    "Test valid usage",
                    AnnotationProcessorIntegrationTestConfigurationBuilder.createTestConfig()
                            .setSourceFileToCompile("testcases/methodWithOneStringParameterAndVoidReturn/ValidUsageTest.java")
                            .addMessageValidator()
                                .setInfoChecks("Start processing")
                            .finishMessageValidator()
                            .compilationShouldSucceed()
                            .build()
            },
            {
                    "Test invalid usage : non void return type",
                    AnnotationProcessorIntegrationTestConfigurationBuilder.createTestConfig()
                            .setSourceFileToCompile("testcases/methodWithOneStringParameterAndVoidReturn/InvalidUsageNonVoidReturnType.java")
                            .compilationShouldFail()
                            .addMessageValidator()
                                .setErrorChecks("Method must have void return type")
                            .finishMessageValidator()
                            .build()
            },
            {
                    "Test invalid usage : non String parameter",
                    AnnotationProcessorIntegrationTestConfigurationBuilder.createTestConfig()
                            .setSourceFileToCompile("testcases/methodWithOneStringParameterAndVoidReturn/InvalidUsageNonStringParameter.java")
                            .compilationShouldFail()
                            .addMessageValidator()
                                .setErrorChecks("Method must have parameters of types [java.lang.String], but has parameters of types [java.lang.Object]")
                            .finishMessageValidator()
                            .build()
            },


    });

}
项目:intellij-randomness    文件:IntegerInsertActionTest.java   
@Parameterized.Parameters
public static Collection<Object[]> params() {
    return Arrays.asList(new Object[][] {
            {0, 0, "0"},
            {1, 1, "1"},
            {-5, -5, "-5"},
            {488, 488, "488"},
            {-876, -876, "-876"},
    });
}
项目:format-preserving-encryption-java    文件:FF1AlgorithmWithRadix45NoEmptyDataKey256Should.java   
@Parameterized.Parameters(name = "{index}: plain text is {0}")
public static Iterable<int[]> data() {
    return Arrays.asList(
            new int[] {18, 27, 13, 34, 44, 6, 37, 28, 10, 9, 16, 3, 2},
            new int[] {4, 4, 5, 4, 7, 0, 9, 4, 3, 2},
            new int[] {11, 33, 44},
            new int[] {37, 25, 16}
    );
}
项目:cas4.0.x-server-wechat    文件:KryoTranscoderTests.java   
@Parameterized.Parameters
public static List<Object[]> getTestParms() {
    final List<Object[]> params = new ArrayList<Object[]>(6);

    // Test case #1 - Buffer is bigger than encoded data
    params.add(new Object[] {1024});

    // Test case #2 - Buffer overflow case
    params.add(new Object[] {10});
    return params;
}
项目:orgzly-android    文件:UriUtilsTest.java   
@Parameterized.Parameters(name= "{index}: #{0} is inside #{1}")
public static Iterable<Object[]> data() {
    return Arrays.asList(new Object[][] {
            { "dropbox:/dir1/dir2/file.org", "dropbox:/dir1/dir2" },
            { "dropbox:/dir/file.org",       "dropbox:/dir"       },
            { "dropbox:/dir",                "dropbox:"           },
            { "dropbox:/dir/",               "dropbox:"           },
            { "dropbox:/",                   "dropbox:"           }
    });
}
项目:poiji    文件:DerializersTest.java   
@Parameterized.Parameters(name = "{index}: ({0})={1}")
public static Iterable<Object[]> queries() throws Exception {
    return Arrays.asList(new Object[][]{
            {"src/test/resources/employees.xlsx", unmarshalling(), null, -1},
            {"src/test/resources/employees_sheet2.xlsx", unmarshalling(), null, 1},
            {"src/test/resources/cloud.xls", unmarshalling(), PoijiException.class, -1},
            {"src/test/resources/cloud", unmarshalling(), PoijiException.class, -1},
    });
}
项目:orgzly-android    文件:BookNameTest.java   
@Parameterized.Parameters(name= "{index}: Filename {0} supported: #{1}")
public static Iterable<Object[]> data() {
    return Arrays.asList(new Object[][] {
            { "filename.org", true },
            { "filename.txt", false },
            { "filename.org.txt", true },
            { ".#filename.org", false },
    });
}
项目:GitHub    文件:WebPlatformUrlTest.java   
@Parameterized.Parameters(name = "{0}")
public static List<Object[]> parameters() {
  try {
    List<Object[]> result = new ArrayList<>();
    for (WebPlatformUrlTestData urlTestData : loadTests()) {
      result.add(new Object[] {urlTestData});
    }
    return result;
  } catch (IOException e) {
    throw new AssertionError();
  }
}
项目:intellij-randomness    文件:StringInsertActionTest.java   
@Parameterized.Parameters
public static Collection<Object[]> params() {
    return Arrays.asList(new Object[][] {
            {0, 0, "", new Alphabet[] {}},
            {0, 0, "'", new Alphabet[] {}},
            {0, 0, "a", new Alphabet[] {}},
            {0, 0, "2Rv", new Alphabet[] {}},

            {723, 723, "", new Alphabet[] {Alphabet.LOWERCASE}},
            {466, 466, "z", new Alphabet[] {Alphabet.UPPERCASE, Alphabet.SPECIAL, Alphabet.UNDERSCORE}}
    });
}
项目:kafka-0.11.0.0-src-with-comment    文件:FileLogInputStreamTest.java   
@Parameterized.Parameters(name = "magic={0}, compression={1}")
public static Collection<Object[]> data() {
    List<Object[]> values = new ArrayList<>();
    for (byte magic : asList(MAGIC_VALUE_V0, MAGIC_VALUE_V1, MAGIC_VALUE_V2))
        for (CompressionType type: CompressionType.values())
            values.add(new Object[] {magic, type});
    return values;
}
项目:netty-connection-pool    文件:BasicMultiNodeConnPoolTest.java   
@Parameterized.Parameters
public static Collection<Object[]> generateData() {
    return Arrays.asList(
        new Object[][] {
            {1, 1},
            {10, 1}, {10, 2}, {10, 5}, {10, 10},
            {100, 1}, {100, 2}, {100, 5}, {100, 10},
            {1000, 1}, {1000, 2}, {1000, 5}, {1000, 10}
        }
    );
}
项目:GitHub    文件:RealmJsonAbsentPrimaryKeyTests.java   
@Parameterized.Parameters
public static Iterable<Object[]> data() {
    return Arrays.asList(new Object[][]{
        {PrimaryKeyAsBoxedByte.class,    "{ \"name\":\"HaHaHaHaHaHaHaHaH\" }"},
        {PrimaryKeyAsBoxedShort.class,   "{ \"name\":\"KeyValueTestIsFun\" }"},
        {PrimaryKeyAsBoxedInteger.class, "{ \"name\":\"FunValueTestIsKey\" }"},
        {PrimaryKeyAsBoxedLong.class,    "{ \"name\":\"NameAsBoxedLong-!\" }"},
        {PrimaryKeyAsString.class,       "{ \"id\":2429214 }"}
    });
}
项目:rehttp    文件:PingingTest.java   
@Parameterized.Parameters(name = "{0}")
public static Collection<Object[]> params() {
    return Arrays.asList(
        new Object[][] {
            {"/?x=y"},
            {"/robots.txt"},
            {"/xsl/layout.xsl"},
            {"/css/main.css"},
            {"/images/logo.svg"},
        }
    );
}
项目:thorium-lang    文件:TestParse.java   
@Parameterized.Parameters
public static Collection<String[]> data() {
    return Arrays.asList(
            new String[]{"/specs/syntax/anyType.txt"},
            new String[]{"/specs/syntax/typeDeclaration.txt"},
            new String[]{"/specs/syntax/methodDeclaration.txt"}
    );
}
项目:kafka-0.11.0.0-src-with-comment    文件:MemoryRecordsBuilderTest.java   
@Parameterized.Parameters(name = "bufferOffset={0}, compression={1}")
public static Collection<Object[]> data() {
    List<Object[]> values = new ArrayList<>();
    for (int bufferOffset : Arrays.asList(0, 15))
        for (CompressionType compressionType : CompressionType.values())
            values.add(new Object[] {bufferOffset, compressionType});
    return values;
}
项目:modern.core.java.repo    文件:VehicleTest.java   
@Parameterized.Parameters
public static Collection spreadsheetData() throws IOException {
    String excelName = "/TestData/VehicleData.xls";
    String localPath = "/src/test/java/Resources";
    String path = System.getProperty("user.dir")+ localPath+excelName;
    InputStream spreadsheet = new FileInputStream(path);
    return new ExcelXlsReaderParameter(spreadsheet).getData();
}
项目:tinkergraph-gremlin    文件:TinkerGraphIdManagerTest.java   
@Parameterized.Parameters(name = "{0}")
public static Iterable<Object[]> data() {
    return Arrays.asList(new Object[][]{
            {"coerceLong", 100l, 200l, 300l},
            {"coerceInt", 100, 200, 300},
            {"coerceDouble", 100d, 200d, 300d},
            {"coerceFloat", 100f, 200f, 300f},
            {"coerceString", "100", "200", "300"}});
}
项目:https-github.com-apache-zookeeper    文件:QuorumRequestPipelineTest.java   
@Parameterized.Parameters
public static Collection<Object[]> data() {
    return Arrays.asList(
        new Object[][] {
            {ServerState.LEADING},
            {ServerState.FOLLOWING},
            {ServerState.OBSERVING}});
}
项目:incubator-ratis    文件:TestRestartRaftPeer.java   
@Parameterized.Parameters
public static Collection<Object[]> data() throws IOException {
  RaftProperties prop = new RaftProperties();
  prop.setClass(MiniRaftCluster.STATEMACHINE_CLASS_KEY,
      SimpleStateMachine4Testing.class, StateMachine.class);
  RaftServerConfigKeys.Log.setSegmentSizeMax(prop, SizeInBytes.valueOf("8KB"));
  return ParameterizedBaseTest.getMiniRaftClusters(prop, 3);
}
项目:Architecting-Modern-Java-EE-Applications    文件:CarManufacturerMassTest.java   
@Parameterized.Parameters(name = "chassis: {0}, engine type: {1}")
public static Collection<Object[]> testData() {
    return Arrays.asList(
            new Object[]{Color.RED, EngineType.DIESEL},
            new Object[]{Color.BLACK, EngineType.DIESEL}
    );
}
项目:hadoop    文件:TestKerberosAuthenticator.java   
@Parameterized.Parameters
public static Collection booleans() {
  return Arrays.asList(new Object[][] {
    { false },
    { true }
  });
}
项目:FSTestTools    文件:MyContextMenuItemTest.java   
@Parameterized.Parameters(name = "{0}/execute:{2}")
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[]{Store.Type.PAGESTORE, mock(Page.class), Boolean.TRUE},
                         new Object[]{Store.Type.PAGESTORE, mock(PageFolder.class), Boolean.FALSE},
                         new Object[]{Store.Type.SITESTORE, mock(PageRef.class), Boolean.FALSE},
                         new Object[]{Store.Type.MEDIASTORE, mock(Media.class), Boolean.FALSE},
                         new Object[]{Store.Type.CONTENTSTORE, mock(Content2.class), Boolean.FALSE},
                         new Object[]{Store.Type.TEMPLATESTORE, mock(Template.class), Boolean.FALSE});
}
项目:item-reaper    文件:ItemsPresenterTest.java   
@Parameterized.Parameters
public static Object[] data() {
    return new Object[]{
            new ArrayList<Item>() {{
                add(ITEM_1);
            }},
            new ArrayList<String>() {{
                // Empty list
            }},
            null
    };
}
项目:jcommander-ext    文件:ExistsFileWritableTest.java   
@Parameterized.Parameters
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[][]{
            {fileMock(), false},
            {fileMock().exists(), false},
            {fileMock().exists().file(), false},
            {fileMock().exists().file().writable(), true},
            {fileMock().exists().dir(), false},
    });
}
项目:creacoinj    文件:PaymentChannelStateTest.java   
/**
 * We use parameterized tests to run the channel connection tests with each
 * version of the channel.
 */
@Parameterized.Parameters(name = "{index}: PaymentChannelStateTest({0})")
public static Collection<PaymentChannelClient.VersionSelector> data() {
    return Arrays.asList(
            PaymentChannelClient.VersionSelector.VERSION_1,
            PaymentChannelClient.VersionSelector.VERSION_2_ALLOW_1);
}
项目:chart-parser    文件:StarterTest.java   
@Parameterized.Parameters(name = "Page {0}, Starter {1}, Breed {2}")
public static Collection runningLines() throws IOException {
    return Arrays.asList(new Object[][]{
            {0, 1, Breed.THOROUGHBRED, new RaceDistance("Six Furlongs", "6f", true, 3960),
                    expectedThoroughbredStarter()},
            {5, 1, Breed.QUARTER_HORSE, new RaceDistance("Three Hundred And Fifty Yards",
                    "350y", true, 1050), expectedQuarterHorseStarter()}
    });
}
项目:hadoop    文件:TestRMAppAttemptTransitions.java   
@Parameterized.Parameters
public static Collection<Object[]> getTestParameters() {
  return Arrays.asList(new Object[][] {
      { Boolean.FALSE },
      { Boolean.TRUE }
  });
}
项目:aws-sdk-java-v2    文件:ModelCopierSpecTest.java   
@Parameterized.Parameters(name = "{1}")
public static Collection<Object[]> data() {
    invokeSafely(ModelCopierSpecTest::setUp);
    return new ServiceModelCopiers(intermediateModel).copierSpecs().stream()
                                                     .map(spec -> new Object[] { spec, spec.className().simpleName().toLowerCase(Locale.ENGLISH) })
                                                     .collect(toList());
}
项目:majx    文件:EmptyTests.java   
@Parameterized.Parameters(name = "{index}: assertJsonMatches({0}, {1})")
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[][]{
            {
                    "empty/object/actual.json",
                    "empty/object/pattern.json",
            },
            {
                    "empty/array/actual.json",
                    "empty/array/pattern.json"
            }
    });
}
项目:embulk-input-parquet_hadoop    文件:TestParquetCompatibility.java   
@Parameterized.Parameters
public static List<String> data()
{
    return Arrays.asList(
            "test-data/parquet-python/nation.plain.parquet",
            "test-data/parquet-python/nation.dict.parquet",
            "test-data/parquet-python/nation.impala.parquet",
            "test-data/parquet-python/snappy-nation.impala.parquet",
            "test-data/parquet-python/gzip-nation.impala.parquet"
    );
}
项目:java-logging    文件:PrettyPrintingDecoratorTest.java   
@Parameterized.Parameters(name = "Is pretty printing be enabled for \"{0}\"? {2}")
public static Iterable<Object[]> data() {
    return Arrays.asList(new Object[][] {
            { "", false },
            { "false", false },
            { "fdjksfdks", false },
            { "true", true }
    });
}