Java Code Examples for org.junit.runners.Parameterized#Parameters

The following examples show how to use org.junit.runners.Parameterized#Parameters . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StringEncoding_RandomizedTest.java    From spliceengine with GNU Affero General Public License v3.0 6 votes vote down vote up
@Parameterized.Parameters
public static Collection<Object[]> getParameters() throws Exception{
    Random random = new Random(0l);
    Collection<Object[]> data = Lists.newArrayList();
    for(int i=0;i<numTestsToRun;i++){
        String[] dataToCheck = new String[numStringsToCheckPerTest];
        for(int j=0;j<dataToCheck.length;j++){
            char[] stringData = new char[random.nextInt(maxStringLength)+1];
            for(int pos=0;pos<stringData.length;pos++){
                stringData[pos ] = chars.charAt(random.nextInt(chars.length()));
            }
            dataToCheck[j] = new String(stringData);
        }
        data.add(new Object[]{dataToCheck});
    }
    return data;
}
 
Example 2
Source File: PropertySourceTokenizerTest.java    From logging-log4j2 with Apache License 2.0 6 votes vote down vote up
@Parameterized.Parameters(name = "{0}")
public static Object[][] data() {
    return new Object[][]{
        {"log4j.simple", Collections.singletonList("simple")},
        {"log4j_simple", Collections.singletonList("simple")},
        {"log4j-simple", Collections.singletonList("simple")},
        {"log4j/simple", Collections.singletonList("simple")},
        {"log4j2.simple", Collections.singletonList("simple")},
        {"Log4jSimple", Collections.singletonList("simple")},
        {"LOG4J_simple", Collections.singletonList("simple")},
        {"org.apache.logging.log4j.simple", Collections.singletonList("simple")},
        {"log4j.simpleProperty", Arrays.asList("simple", "property")},
        {"log4j.simple_property", Arrays.asList("simple", "property")},
        {"LOG4J_simple_property", Arrays.asList("simple", "property")},
        {"LOG4J_SIMPLE_PROPERTY", Arrays.asList("simple", "property")},
        {"log4j2-dashed-propertyName", Arrays.asList("dashed", "property", "name")},
        {"Log4jProperty_with.all-the/separators", Arrays.asList("property", "with", "all", "the", "separators")},
        {"org.apache.logging.log4j.config.property", Arrays.asList("config", "property")},
    };
}
 
Example 3
Source File: ClusterStatsServiceGetVersionMismatchTest.java    From newrelic-elasticsearch with MIT License 5 votes vote down vote up
@Parameterized.Parameters
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[][] {
        { new ArrayList<String>(), 0},
        { new ArrayList<String>(Arrays.asList("1")), 1},
        { new ArrayList<String>(Arrays.asList("1.3.1", "1.4.2")), 2},
        { new ArrayList<String>(Arrays.asList("1", "2", "3")), 3},
    });
}
 
Example 4
Source File: ServerErrorIntegrationTest.java    From reactive-grpc with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Parameterized.Parameters
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[][] {
            { new TestService(), false },
            { new FusedTestService(), true }
    });
}
 
Example 5
Source File: JobSubmitHandlerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Parameterized.Parameters(name = "SSL enabled: {0}")
public static Iterable<Tuple2<Boolean, String>> data() {
	ArrayList<Tuple2<Boolean, String>> parameters = new ArrayList<>(3);
	parameters.add(Tuple2.of(false, "no SSL"));
	for (String sslProvider : SSLUtilsTest.AVAILABLE_SSL_PROVIDERS) {
		parameters.add(Tuple2.of(true, sslProvider));
	}
	return parameters;
}
 
Example 6
Source File: HBaseConnectorITCase.java    From flink with Apache License 2.0 5 votes vote down vote up
@Parameterized.Parameters(name = "planner = {0}, legacy = {1}")
public static Object[] parameters() {
	return new Object[][]{
		new Object[]{PlannerType.BLINK_PLANNER, true},
		new Object[]{PlannerType.BLINK_PLANNER, false},
		new Object[]{PlannerType.OLD_PLANNER, true}
	};
}
 
Example 7
Source File: W3cComplianceTest.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Parameterized.Parameters(name = "{0}")
public static Collection<URL> data() {

	ArrayList<URL> urls = new ArrayList<>(getTestFiles());
	urls.sort(Comparator.comparing(URL::toString));
	return urls;
}
 
Example 8
Source File: DeserializersPasswordStreamTest.java    From poiji with MIT License 5 votes vote down vote up
@Parameterized.Parameters(name = "{index}: ({0})={1}")
public static Iterable<Object[]> queries() {
    return Arrays.asList(new Object[][]{
            {"src/test/resources/employees-password.xlsx", unmarshallingDeserialize(), null, "1234", PoijiExcelType.XLSX},
            {"src/test/resources/employees-password.xls", unmarshallingDeserialize(), null, "9876", PoijiExcelType.XLS},
    });
}
 
Example 9
Source File: ReflectionSerializationTests.java    From mavlink with MIT License 5 votes vote down vote up
@Parameterized.Parameters
public static Collection<Object[]> parameters() {
    return Arrays.asList(new Object[][]{
                    {
                            CommandLong.builder()
                                    .command(MavCmd.MAV_CMD_COMPONENT_ARM_DISARM)
                                    .param1(1)
                                    .param2(2989.0f)
                                    .targetSystem(1)
                                    .targetComponent(0)
                                    .build()
                    },
                    {
                            LogData.builder()
                                    .id(123)
                                    .ofs(46080)
                                    .count(90)
                                    .data(Arrays.copyOf("Test data".getBytes(StandardCharsets.UTF_8), 90))
                                    .build()
                    },
                    {
                            ActuatorControlTarget.builder()
                                    .timeUsec(new BigInteger(new byte[] { -7, -6, -5, -4, -3, -2 ,-1, 0 }))
                                    .build()
                    }
            }
    );
}
 
Example 10
Source File: ConcurrentBatchIdentifierTest.java    From high-performance-java-persistence with Apache License 2.0 5 votes vote down vote up
@Parameterized.Parameters
public static Collection<Object[]> dataProvider() {
    MySQLDataSourceProvider mySQLDataSourceProvider = new MySQLDataSourceProvider();
    PostgreSQLDataSourceProvider postgreSQLDataSourceProvider = new PostgreSQLDataSourceProvider();
    IdentityPostEntityProvider identityPostEntityProvider = new IdentityPostEntityProvider();
    SequencePostEntityProvider sequencePostEntityProvider = new SequencePostEntityProvider();
    TablePostEntityProvider tablePostEntityProvider = new TablePostEntityProvider();

    List<Object[]> providers = new ArrayList<>();
    providers.add(new Object[]{mySQLDataSourceProvider, tablePostEntityProvider, 1});
    providers.add(new Object[]{mySQLDataSourceProvider, tablePostEntityProvider, 2});
    providers.add(new Object[]{mySQLDataSourceProvider, tablePostEntityProvider, 4});
    providers.add(new Object[]{mySQLDataSourceProvider, tablePostEntityProvider, 8});
    providers.add(new Object[]{mySQLDataSourceProvider, tablePostEntityProvider, 16});
    providers.add(new Object[]{mySQLDataSourceProvider, identityPostEntityProvider, 1});
    providers.add(new Object[]{mySQLDataSourceProvider, identityPostEntityProvider, 2});
    providers.add(new Object[]{mySQLDataSourceProvider, identityPostEntityProvider, 4});
    providers.add(new Object[]{mySQLDataSourceProvider, identityPostEntityProvider, 8});
    providers.add(new Object[]{mySQLDataSourceProvider, identityPostEntityProvider, 16});

    providers.add(new Object[]{postgreSQLDataSourceProvider, tablePostEntityProvider, 1});
    providers.add(new Object[]{postgreSQLDataSourceProvider, tablePostEntityProvider, 2});
    providers.add(new Object[]{postgreSQLDataSourceProvider, tablePostEntityProvider, 4});
    providers.add(new Object[]{postgreSQLDataSourceProvider, tablePostEntityProvider, 8});
    providers.add(new Object[]{postgreSQLDataSourceProvider, tablePostEntityProvider, 16});
    providers.add(new Object[]{postgreSQLDataSourceProvider, sequencePostEntityProvider, 1});
    providers.add(new Object[]{postgreSQLDataSourceProvider, sequencePostEntityProvider, 2});
    providers.add(new Object[]{postgreSQLDataSourceProvider, sequencePostEntityProvider, 4});
    providers.add(new Object[]{postgreSQLDataSourceProvider, sequencePostEntityProvider, 8});
    providers.add(new Object[]{postgreSQLDataSourceProvider, sequencePostEntityProvider, 16});
    return providers;
}
 
Example 11
Source File: FigureImplColorTest.java    From codenjoy with GNU General Public License v3.0 5 votes vote down vote up
@Parameterized.Parameters
public static Collection<Object[]> data() {
    Object[][] data = new Object[][] {
            { Type.I, 0b001},
            { Type.J, 0b010},
            { Type.L, 0b011},
            { Type.O, 0b100},
            { Type.S, 0b101},
            { Type.T, 0b110},
            { Type.Z, 0b111},
    };
    return Arrays.asList(data);
}
 
Example 12
Source File: JWTSecurityServiceTest.java    From airsonic-advanced with GNU General Public License v3.0 5 votes vote down vote up
@Parameterized.Parameters
public static Collection<Object[]> data() {
    return Arrays.asList(new Object[][] {
            { "http://localhost:8080/airsonic/stream?id=4", "/airsonic/stream?id=4" },
            { "/airsonic/stream?id=4", "/airsonic/stream?id=4" },
    });
}
 
Example 13
Source File: Abstract2dModelBatchTest.java    From javascad with GNU General Public License v2.0 5 votes vote down vote up
@Parameterized.Parameters(name="{0}")
public static Collection<Object[]> testCases() {
	List<Object[]> result = new ArrayList<Object[]>();
	for (Abstract2dModel testCase : createTestSubjects()) {
		result.add(new Object[] {testCase});
	}
	return result;
}
 
Example 14
Source File: GetManagerTest.java    From ambry with Apache License 2.0 5 votes vote down vote up
/**
 * Running for both regular and encrypted blobs, and versions 2 and 3 of MetadataContent
 * @return an array with all four different choices
 */
@Parameterized.Parameters
public static List<Object[]> data() {
  return Arrays.asList(new Object[][]{{false, MessageFormatRecord.Metadata_Content_Version_V2},
      {false, MessageFormatRecord.Metadata_Content_Version_V3},
      {true, MessageFormatRecord.Metadata_Content_Version_V2},
      {true, MessageFormatRecord.Metadata_Content_Version_V3}});
}
 
Example 15
Source File: AwsProxyHttpServletRequestTest.java    From aws-serverless-java-container with Apache License 2.0 4 votes vote down vote up
@Parameterized.Parameters
public static Collection<Object> data() {
    return Arrays.asList(new Object[] { "API_GW", "ALB", "HTTP_API", "WRAP" });
}
 
Example 16
Source File: ClassDataTypeConverterTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Parameterized.Parameters(name = "[{index}] class: {0} type: {1}")
public static List<Object[]> testData() {
	return Arrays.asList(
		new Object[][]{

			{long.class, DataTypes.BIGINT().notNull().bridgedTo(long.class)},

			{byte[].class, DataTypes.BYTES().nullable().bridgedTo(byte[].class)},

			{Long.class, DataTypes.BIGINT().nullable().bridgedTo(Long.class)},

			{java.sql.Time.class, DataTypes.TIME(0).nullable().bridgedTo(java.sql.Time.class)},

			{
				java.time.Duration.class,
				DataTypes.INTERVAL(DataTypes.SECOND(9))
					.bridgedTo(java.time.Duration.class)
			},

			{
				java.time.Period.class,
				DataTypes.INTERVAL(DataTypes.YEAR(4), DataTypes.MONTH())
					.bridgedTo(java.time.Period.class)
			},

			{BigDecimal.class, null},

			{
				byte[][].class,
				DataTypes.ARRAY(DataTypes.BYTES().nullable().bridgedTo(byte[].class))
					.nullable()
					.bridgedTo(byte[][].class)
			},

			{
				Byte[].class,
				DataTypes.ARRAY(DataTypes.TINYINT().nullable().bridgedTo(Byte.class))
					.nullable()
					.bridgedTo(Byte[].class)
			},

			{
				Byte[][].class,
				DataTypes.ARRAY(
					DataTypes.ARRAY(DataTypes.TINYINT().nullable().bridgedTo(Byte.class))
						.nullable()
						.bridgedTo(Byte[].class))
					.nullable()
					.bridgedTo(Byte[][].class)
			},

			{
				Integer[].class,
				DataTypes.ARRAY(DataTypes.INT().nullable().bridgedTo(Integer.class))
					.nullable()
					.bridgedTo(Integer[].class)
			},

			{
				int[].class,
				DataTypes.ARRAY(DataTypes.INT().notNull().bridgedTo(int.class))
					.nullable()
					.bridgedTo(int[].class)
			},

			{
				TimeIntervalUnit.class,
				new AtomicDataType(new SymbolType<>(TimeIntervalUnit.class))
					.bridgedTo(TimeIntervalUnit.class)
			},

			{Row.class, null}
		}
	);
}
 
Example 17
Source File: BlobStoreStatsTest.java    From ambry with Apache License 2.0 4 votes vote down vote up
/**
 * Running for both segmented and non-segmented log.
 * @return an array with both {@code false} and {@code true}.
 */
@Parameterized.Parameters
public static List<Object[]> data() {
  return Arrays.asList(new Object[][]{{false, false}, {true, false}, {false, true}, {true, true}});
}
 
Example 18
Source File: ValueDataTypeConverterTest.java    From flink with Apache License 2.0 4 votes vote down vote up
@Parameterized.Parameters(name = "[{index}] value: {0} type: {1}")
public static List<Object[]> testData() {
	return Arrays.asList(
		new Object[][]{

			{"Hello World", DataTypes.CHAR(11)},

			{"", new AtomicDataType(CharType.ofEmptyLiteral())},

			{new byte[]{1, 2, 3}, DataTypes.BINARY(3)},

			{new byte[0], new AtomicDataType(BinaryType.ofEmptyLiteral())},

			{BigDecimal.ZERO, DataTypes.DECIMAL(1, 0)},

			{new BigDecimal("12.123"), DataTypes.DECIMAL(5, 3)},

			{12, DataTypes.INT()},

			{LocalTime.of(13, 24, 25, 1000), DataTypes.TIME(6)},

			{LocalTime.of(13, 24, 25, 0), DataTypes.TIME(0)},

			{LocalTime.of(13, 24, 25, 1), DataTypes.TIME(9)},

			{LocalTime.of(13, 24, 25, 999_999_999), DataTypes.TIME(9)},

			{LocalDateTime.of(2019, 11, 11, 13, 24, 25, 1001), DataTypes.TIMESTAMP(9)},

			{
				ZonedDateTime.of(2019, 11, 11, 13, 24, 25, 1001, ZoneId.systemDefault()),
				DataTypes.TIMESTAMP_WITH_TIME_ZONE(9).bridgedTo(ZonedDateTime.class)
			},

			{
				OffsetDateTime.of(2019, 11, 11, 13, 24, 25, 1001, ZoneOffset.UTC),
				DataTypes.TIMESTAMP_WITH_TIME_ZONE(9).bridgedTo(OffsetDateTime.class)
			},

			{
				Instant.ofEpochMilli(12345602021L),
				DataTypes.TIMESTAMP_WITH_LOCAL_TIME_ZONE(3).bridgedTo(Instant.class)
			},

			{
				Period.ofYears(1000),
				DataTypes.INTERVAL(DataTypes.YEAR(4), DataTypes.MONTH()).bridgedTo(Period.class)
			},

			{
				Duration.ofMillis(1100),
				DataTypes.INTERVAL(DataTypes.DAY(1), DataTypes.SECOND(1)).bridgedTo(Duration.class)
			},

			{
				Duration.ofDays(42),
				DataTypes.INTERVAL(DataTypes.DAY(2), DataTypes.SECOND(0)).bridgedTo(Duration.class)
			},

			{
				Timestamp.valueOf("2018-01-01 12:13:14.123"),
				DataTypes.TIMESTAMP(3).bridgedTo(java.sql.Timestamp.class)
			},

			{new Integer[]{1, 2, 3}, DataTypes.ARRAY(DataTypes.INT())},

			{new Integer[]{1, null, 3}, DataTypes.ARRAY(DataTypes.INT())},

			{
				new BigDecimal[]{new BigDecimal("12.1234"), new BigDecimal("42.4321"), new BigDecimal("20.0000")},
				DataTypes.ARRAY(DataTypes.DECIMAL(6, 4))
			},

			{
				new BigDecimal[]{null, new BigDecimal("42.4321")},
				DataTypes.ARRAY(DataTypes.DECIMAL(6, 4))
			},

			{new Integer[0], DataTypes.ARRAY(DataTypes.INT())},

			{
				new Integer[][]{new Integer[]{1, null, 3}, new Integer[0], new Integer[]{1}},
				DataTypes.ARRAY(DataTypes.ARRAY(DataTypes.INT()))
			},

			{
				TimePointUnit.HOUR,
				new AtomicDataType(new SymbolType<>(TimePointUnit.class))
			},

			{
				new BigDecimal[0],
				null
			}
		}
	);
}
 
Example 19
Source File: StructuralVariantParameterizedTest.java    From oncokb with GNU Affero General Public License v3.0 4 votes vote down vote up
@Parameterized.Parameters
public static Collection<String[]> getParameters() throws IOException {
    return importer();
}
 
Example 20
Source File: PtlTestBase.java    From hifive-pitalium with Apache License 2.0 2 votes vote down vote up
/**
 * Capabilityの読み込みを行います。
 *
 * @return Capabilityのリスト
 */
@Parameterized.Parameters(name = "{0}")
public static List<PtlCapabilities[]> readCapabilities() {
	return PtlCapabilities.readCapabilities();
}