类org.junit.experimental.theories.DataPoints源码实例Demo

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

源代码1 项目: artio   文件: MutableAsciiBufferTest.java
@DataPoints
public static int[][] valuesAndLengths()
{
    return new int[][]
    {
        {1, 1},
        {10, 2},
        {100, 3},
        {1000, 4},
        {12, 2},
        {123, 3},
        {2345, 4},
        {9, 1},
        {99, 2},
        {999, 3},
        {9999, 4},
    };
}
 
源代码2 项目: io   文件: ODataUtilsTest.java
/**
 * Double型の有効値チェックテストパターンを作成.
 * @return テストパターン
 */
@DataPoints
public static FixtureForDouble[] getFixture() {
    FixtureForDouble[] datas = {
            new FixtureForDouble("負の最小値(-1.79e308d)の場合にtrueが返却されること", -1.79e308d, true),
            new FixtureForDouble("負の最大値(-2.23e-308d)の場合にtrueが返却されること", -2.23e-308d, true),
            new FixtureForDouble("正の最小値(2.23e-308d)の場合にtrueが返却されること", 2.23e-308d, true),
            new FixtureForDouble("正の最大値(1.79e308d)の場合にtrueが返却されること", 1.79e308d, true),
            new FixtureForDouble("負の最小値より小さい値(-1.791e308d)の場合にfalseが返却されること", -1.791e308d, false),
            new FixtureForDouble("負の最小値より大きい値(-1.789e308d)の場合にtrueが返却されること", -1.789e308d, true),
            new FixtureForDouble("負の最大値より小さい値(-2.231e-308d)の場合にtrueが返却されること", -2.231e-308d, true),
            new FixtureForDouble("負の最大値より大きい値(-2.229e-308d)の場合にfalseが返却されること", -2.229e-308d, false),
            new FixtureForDouble("正の最小値より小さい値(2.229e-308d)の場合にfalseが返却されること", 2.229e-308d, false),
            new FixtureForDouble("正の最小値より大きい値(2.231e-308d)の場合にtrueが返却されること", 2.231e-308d, true),
            new FixtureForDouble("正の最大値より小さい値(1.789e308d)の場合にtrueが返却されること", 1.789e308d, true),
            new FixtureForDouble("正の最大値より大きい値(1.791e308d)の場合にfalseが返却されること", 1.791e308d, false),
            new FixtureForDouble("0dの場合にtrueが返却されること", 0d, true),
    };
    return datas;
}
 
源代码3 项目: io   文件: RangeHeaderHandlerTest.java
/**
 * 正常系テストデータ. 正常なレンジヘッダフィールドが指定された場合のテスト
 * @return テストデータ
 */
@DataPoints
public static Fixture[] getFixture() {
    Fixture[] datas = {
            // ※前提 first-byte-pos:a last-byte-pos:b suffix-length:c entitylength:Z
            // a = 0 < b
            new Fixture(1, "bytes=0-26", 100, 0, 26, 27, "bytes 0-26/100"),
            // a ≠ 0 < b
            new Fixture(2, "bytes=3-7", 100, 3, 7, 5, "bytes 3-7/100"),
            // bがない場合は、entitybodyの最後までを終端として扱う
            new Fixture(3, "bytes=10-", 100, 10, 99, 90, "bytes 10-99/100"),
            // Z<bの場合は、entitybodyの最後までを終端として扱う
            new Fixture(4, "bytes=10-150", 100, 10, 99, 90, "bytes 10-99/100"),
            // c<Zの場合(開始が省略)は、ファイルの終端からc分を扱う
            new Fixture(5, "bytes=-10", 100, 90, 99, 10, "bytes 90-99/100"),
            // c>Zの場合(開始が省略かつファイルサイズより指定が大きい)は、ファイル全体を扱う
            new Fixture(6, "bytes=-150", 100, 0, 99, 100, "bytes 0-99/100"),
            // a=b場合
            new Fixture(7, "bytes=10-10", 100, 10, 10, 1, "bytes 10-10/100"),
            // a=b=Zの場合
            new Fixture(8, "bytes=99-99", 100, 99, 99, 1, "bytes 99-99/100") };
    return datas;
}
 
源代码4 项目: io   文件: RangeHeaderHandlerTest.java
/**
 * 無視系ーヘッダ無視パターンテストデータ. 無効なレンジヘッダフィールドの指定のテスト
 * @return テストデータ
 */
@DataPoints
public static Fixture[] getFixture() {
    Fixture[] datas = {
            // ※前提 first-byte-pos:a last-byte-pos:b suffix-length:c entitybody:Z
            // b < Z < a(開始と終端がひっくり返っている)
            new Fixture(1, "bytes=500-10", 100),
            // b < a < Z(開始と終端がひっくり返っている)
            new Fixture(2, "bytes=50-10", 100),
            // -がない場合
            new Fixture(3, "bytes=50", 100),
            // c = 0
            new Fixture(4, "bytes=-0", 100),
            // byte-unitがない場合
            new Fixture(5, "hoge=10-20", 100),
            // aが文字列の場合
            new Fixture(6, "bytes=hoge-20", 100),
            // bが文字列の場合
            new Fixture(7, "bytes=10-hoge", 100),
            // aが負の数の場合
            new Fixture(8, "bytes=-10-11", 100),
            // bが負の数の場合
            new Fixture(8, "bytes=10--11", 100)};
    return datas;
}
 
源代码5 项目: io   文件: AbstractODataResourceTest.java
/**
 * Double型の有効値チェックテストパターンを作成.
 * @return テストパターン
 */
@DataPoints
public static Fixture[] getFixture() {
    Fixture[] datas = {
            new Fixture("負の最小値(-1.79e308d)の場合に例外がスローされないこと", -1.79e308d, true),
            new Fixture("負の最大値(-2.23e-308d)の場合に例外がスローされないこと", -2.23e-308d, true),
            new Fixture("正の最小値(2.23e-308d)の場合に例外がスローされないこと", 2.23e-308d, true),
            new Fixture("正の最大値(1.79e308d)の場合に例外がスローされないこと", 1.79e308d, true),
            new Fixture("負の最小値より小さい値(-1.791e308d)の場合に例外コード[PR400-OD-0006]の例外がスローされること", -1.791e308d, false),
            new Fixture("負の最小値より大きい値(-1.789e308d)の場合に例外がスローされないこと", -1.789e308d, true),
            new Fixture("負の最大値より小さい値(-2.231e-308d)の場合に例外がスローされないこと", -2.231e-308d, true),
            new Fixture("負の最大値より大きい値(-2.229e-308d)の場合に例外コード[PR400-OD-0006]の例外がスローされること", -2.229e-308d, false),
            new Fixture("正の最小値より小さい値(2.229e-308d)の場合に例外コード[PR400-OD-0006]の例外がスローされること", 2.229e-308d, false),
            new Fixture("正の最小値より大きい値(2.231e-308d)の場合に例外がスローされないこと", 2.231e-308d, true),
            new Fixture("正の最大値より小さい値(1.789e308d)の場合に例外がスローされないこと", 1.789e308d, true),
            new Fixture("正の最大値より大きい値(1.791e308d)の場合に例外コード[PR400-OD-0006]の例外がスローされること", 1.791e308d, false),
            new Fixture("0の場合にtrueが返却されること", 0d, true)
    };
    return datas;
}
 
@SuppressWarnings("ArraysAsListWithZeroOrOneArgument") // makes it more symmetric
@DataPoints("validParameters")
public static T[] validParameters() {
  return new T[] {
    t("B.m()", null, asList()),
    t("B.m(NAME)", null, asList(LoggerInitializerParameter.NAME)),
    t("B.m(TYPE)", null, asList(LoggerInitializerParameter.TYPE)),
    t("B.m(NULL)", null, asList(LoggerInitializerParameter.NULL)),

    t("B.m(NAME,NULL,NAME)", null,
      asList(LoggerInitializerParameter.NAME, LoggerInitializerParameter.NULL, LoggerInitializerParameter.NAME)),
    t("B.m(NAME,TOPIC)", asList(LoggerInitializerParameter.NAME, LoggerInitializerParameter.TOPIC), null),
    t("B.m(TOPIC,TOPIC)(NULL)", asList(LoggerInitializerParameter.TOPIC, LoggerInitializerParameter.TOPIC),
      asList(LoggerInitializerParameter.NULL)),
    t("B.m()(TOPIC,TYPE)", asList(LoggerInitializerParameter.TOPIC, LoggerInitializerParameter.TYPE), asList())
  };
}
 
源代码7 项目: intellij-xquery   文件: RunnerAppTest.java
@DataPoints
public static DataPair[] getFullyCompatibleData() {
    return new DataPair[]{
            DataPair.pair(XS_INTEGER, NUMERIC_VALUE),
            DataPair.pair(XS_INT, NUMERIC_VALUE),
            DataPair.pair(XS_SHORT, NUMERIC_VALUE),
            DataPair.pair(XS_LONG, NUMERIC_VALUE),
            DataPair.pair(XS_DECIMAL, FLOATING_POINT_VALUE),
            DataPair.pair(XS_DOUBLE, FLOATING_POINT_VALUE),
            DataPair.pair(XS_FLOAT, FLOATING_POINT_VALUE),
            DataPair.pair(XS_BOOLEAN, "true"),
            DataPair.pair(XS_STRING, VALUE),
            DataPair.pair(XS_HEX_BINARY, "FFFF"),
            DataPair.pair(XS_DAY_TIME_DURATION, "P4DT12H30M5S"),
            DataPair.pair(XS_YEAR_MONTH_DURATION, "P3Y6M"),
            DataPair.pair(XS_DATE, "2013-12-31"),
            DataPair.pair(XS_DATE_TIME, "2013-12-31T23:59:59"),
            DataPair.pair(XS_TIME, "23:59:59"),
            DataPair.pair(XS_G_DAY, "---01"),
            DataPair.pair(XS_G_MONTH, "--01"),
            DataPair.pair(XS_G_MONTH_DAY, "--01-01"),
            DataPair.pair(XS_G_YEAR, "0001"),
            DataPair.pair(XS_G_YEAR_MONTH, "0001-01"),
            DataPair.pair(XS_ANY_URI, VALUE),
    };
}
 
源代码8 项目: intellij-xquery   文件: SaxonRunnerAppTest.java
@DataPoints
public static DataPair[] getSaxonCompatibleData() {
    return new DataPair[]{
            DataPair.pair(XS_NON_NEGATIVE_INTEGER, NUMERIC_VALUE),
            DataPair.pair(XS_POSITIVE_INTEGER, NUMERIC_VALUE),
            DataPair.pair(XS_NON_POSITIVE_INTEGER, NEGATIVE_NUMERIC_VALUE),
            DataPair.pair(XS_NEGATIVE_INTEGER, NEGATIVE_NUMERIC_VALUE),
            DataPair.pair(XS_UNSIGNED_INT, NUMERIC_VALUE),
            DataPair.pair(XS_UNSIGNED_SHORT, NUMERIC_VALUE),
            DataPair.pair(XS_UNSIGNED_LONG, NUMERIC_VALUE),
            DataPair.pair(XS_UNSIGNED_BYTE, "10"),
            DataPair.pair(XS_DURATION, "P3Y6M4DT12H30M5S"),
            DataPair.pair(XS_BYTE, "32"),
            DataPair.pair(XS_NORMALIZED_STRING, VALUE),
            DataPair.pair(XS_TOKEN, VALUE),
            DataPair.pair(XS_LANGUAGE, VALUE),
            DataPair.pair(XS_UNTYPED_ATOMIC, VALUE),
            DataPair.pair(TEXT, VALUE),
    };
}
 
@DataPoints
public static DataPair[] getSaxonCompatibleData() {
    return new DataPair[]{
            DataPair.pair(XS_NON_NEGATIVE_INTEGER, NUMERIC_VALUE),
            DataPair.pair(XS_POSITIVE_INTEGER, NUMERIC_VALUE),
            DataPair.pair(XS_NON_POSITIVE_INTEGER, NEGATIVE_NUMERIC_VALUE),
            DataPair.pair(XS_NEGATIVE_INTEGER, NEGATIVE_NUMERIC_VALUE),
            DataPair.pair(XS_UNSIGNED_INT, NUMERIC_VALUE),
            DataPair.pair(XS_UNSIGNED_SHORT, NUMERIC_VALUE),
            DataPair.pair(XS_UNSIGNED_LONG, NUMERIC_VALUE),
            DataPair.pair(XS_UNSIGNED_BYTE, "10"),
            DataPair.pair(XS_DURATION, "P3Y6M4DT12H30M5S"),
            DataPair.pair(XS_BYTE, "32"),
            DataPair.pair(XS_NORMALIZED_STRING, VALUE),
            DataPair.pair(XS_TOKEN, VALUE),
            DataPair.pair(XS_LANGUAGE, VALUE),
            DataPair.pair(XS_DATE_TIME_STAMP, "2013-12-31T23:59:59Z"),
            DataPair.pair(XS_UNTYPED, VALUE),
            DataPair.pair(XS_UNTYPED_ATOMIC, VALUE),
            DataPair.pair(TEXT, VALUE),
    };
}
 
源代码10 项目: tutorials   文件: NumberOfDigitsIntegrationTest.java
@DataPoints
public static int[][] lowestIntegers()
{
  return new int[][]{
      {1, 1}, 
      {2, 10}, 
      {3, 100}, 
      {4, 1000}, 
      {5, 10000}, 
      {6, 100000}, 
      {7, 1000000}, 
      {8, 10000000}, 
      {9, 100000000}, 
      {10, 1000000000}
  };
}
 
源代码11 项目: tutorials   文件: NumberOfDigitsIntegrationTest.java
@DataPoints
public static int[][] highestIntegers()
{
  return new int[][]{
      {1, 9}, 
      {2, 99}, 
      {3, 999}, 
      {4, 9999}, 
      {5, 99999}, 
      {6, 999999}, 
      {7, 9999999}, 
      {8, 99999999}, 
      {9, 999999999}, 
      {10, Integer.MAX_VALUE}
  };
}
 
源代码12 项目: tutorials   文件: NumberOfDigitsIntegrationTest.java
@DataPoints
public static int[][] randomIntegers()
{
  return new int[][]{
      {1, 1}, 
      {2, 14}, 
      {3, 549}, 
      {4, 1136}, 
      {5, 25340}, 
      {6, 134321}, 
      {7, 1435432}, 
      {8, 54234129}, 
      {9, 113683912}, 
      {10, 1534031982}
  };
}
 
源代码13 项目: spliceengine   文件: ExhaustiveLongEncodingTest.java
@DataPoints public static long[] powersOf2(){
    LongArrayList dataPoints = new LongArrayList(100);
    long l = 1l;
    while(l>0){
        dataPoints.add(l);
        dataPoints.add(-l);
        dataPoints.add(3*l);
        dataPoints.add(-3*l);
        dataPoints.add(5*l);
        dataPoints.add(-5*l);
        dataPoints.add(7*l);
        dataPoints.add(-7*l);
        l<<=1;
    }

    return dataPoints.toArray();
}
 
@DataPoints public static BigDecimal[] knownProblemPoints(){
    return new BigDecimal[]{
            BigDecimal.valueOf(-9208636019293794487l), //DB-3421
            BigDecimal.valueOf(-9169196554323565708l), //DB-3421
            BigDecimal.valueOf(-9219236770852362184l), //contains 0 bytes internally
            BigDecimal.valueOf(Integer.MIN_VALUE),
            BigDecimal.valueOf(Integer.MAX_VALUE),
            BigDecimal.valueOf(Long.MIN_VALUE),
            BigDecimal.valueOf(Long.MAX_VALUE),
            BigDecimal.valueOf(Long.MAX_VALUE | Long.MIN_VALUE), //all 1s
            BigDecimal.valueOf(Integer.MAX_VALUE| Integer.MIN_VALUE), //all 1s, but only in the integer space
            BigDecimal.valueOf(18278),
            BigDecimal.ZERO,
            BigDecimal.ONE,
            BigDecimal.TEN,
    };
}
 
@DataPoints
public static List<String> generatePasswords() {
    Random random = new Random(100);
    List<String> passwords = new ArrayList<>(10);
    for (int i = 0; i < 10; i++) {
        int length = random.nextInt(24) + 8;
        StringBuilder sb = new StringBuilder(length);
        for (int j = 0; j < length; j++) {
            // choose a (printable) character in the closed range [' ', '~']
            // 0x7f is DEL, 0x7e is ~, and space is the first printable ASCII character
            char next = (char) (' ' + random.nextInt('\u007f' - ' '));
            sb.append(next);
        }
        passwords.add(sb.toString());
    }
    return passwords;
}
 
@DataPoints
public static List<String> generatePasswords() {
    Random random = new Random(100);
    List<String> passwords = new ArrayList<>(10);
    for (int i = 0; i < 10; i++) {
        int length = random.nextInt(24) + 8;
        StringBuilder sb = new StringBuilder(length);
        for (int j = 0; j < length; j++) {
            // choose a (printable) character in the closed range [' ', '~']
            // 0x7f is DEL, 0x7e is ~, and space is the first printable ASCII character
            char next = (char) (' ' + random.nextInt('\u007f' - ' '));
            sb.append(next);
        }
        passwords.add(sb.toString());
    }
    return passwords;
}
 
源代码17 项目: netty-4.1.22   文件: AbstractEncoderTest.java
@DataPoints("smallData")
public static ByteBuf[] smallData() {
    ByteBuf heap = Unpooled.wrappedBuffer(BYTES_SMALL);
    ByteBuf direct = Unpooled.directBuffer(BYTES_SMALL.length);
    direct.writeBytes(BYTES_SMALL);
    return new ByteBuf[] {heap, direct};
}
 
源代码18 项目: netty-4.1.22   文件: AbstractEncoderTest.java
@DataPoints("largeData")
public static ByteBuf[] largeData() {
    ByteBuf heap = Unpooled.wrappedBuffer(BYTES_LARGE);
    ByteBuf direct = Unpooled.directBuffer(BYTES_LARGE.length);
    direct.writeBytes(BYTES_LARGE);
    return new ByteBuf[] {heap, direct};
}
 
源代码19 项目: netty-4.1.22   文件: AbstractDecoderTest.java
@DataPoints("smallData")
public static ByteBuf[] smallData() {
    ByteBuf heap = Unpooled.wrappedBuffer(compressedBytesSmall);
    ByteBuf direct = Unpooled.directBuffer(compressedBytesSmall.length);
    direct.writeBytes(compressedBytesSmall);
    return new ByteBuf[] {heap, direct};
}
 
源代码20 项目: netty-4.1.22   文件: AbstractDecoderTest.java
@DataPoints("largeData")
public static ByteBuf[] largeData() {
    ByteBuf heap = Unpooled.wrappedBuffer(compressedBytesLarge);
    ByteBuf direct = Unpooled.directBuffer(compressedBytesLarge.length);
    direct.writeBytes(compressedBytesLarge);
    return new ByteBuf[] {heap, direct};
}
 
源代码21 项目: bobcat   文件: CommonEmailDataPredicatesTest.java
@DataPoints(value = "isReceivedAfter")
public static Object[][] forIsReceivedAfter() {
  return new Object[][]{
      {LocalDateTime.of(1999, 1, 1, 0, 0), true},
      {LocalDateTime.of(2010, 2, 14, 16, 59), true},
      {LocalDateTime.of(2010, 2, 14, 17, 0), false}
  };
}
 
源代码22 项目: bobcat   文件: CommonEmailDataPredicatesTest.java
@DataPoints(value = "containsText")
public static Object[][] forContainsText() {
  return new Object[][]{
      {"sample", true},
      {"sample message content", true},
      {"", true},
      {"null", false},
      {"subject", false}
  };
}
 
源代码23 项目: bobcat   文件: CommonEmailDataPredicatesTest.java
@DataPoints(value = "emails")
public static Object[][] forEmailTests() {
  return new Object[][]{
      // email, isSender, isRecipient
      {"[email protected]", true, false},
      {"[email protected]", false, true},
      {"[email protected]", false, false},
      {"[email protected]", false, false}
  };
}
 
源代码24 项目: gflogger   文件: BufferFormatterPropertyTest.java
@DataPoints
public static Integer[] importantIntegers() {
	//start from few crucial samples, and apply a set of transform
	final int[] seeds = {
			Integer.MIN_VALUE,
			Short.MIN_VALUE,
			Byte.MIN_VALUE,
			-1,
			0,
			1,
			Byte.MAX_VALUE,
			Short.MAX_VALUE,
			Integer.MAX_VALUE
	};

	final ArrayList<Integer> integers = new ArrayList<Integer>();
	for( final int seed : seeds ) {
		integers.add( seed );
	}

	for( final Integer integer : new ArrayList<Integer>( integers ) ) {
		for( int i = Byte.MIN_VALUE; i < Byte.MAX_VALUE; i++ ) {
			integers.add( integer + i );
		}
	}

	return integers.toArray( new Integer[0] );
}
 
源代码25 项目: gflogger   文件: BufferFormatterPropertyTest.java
@DataPoints
public static Long[] importantLongs() {
	//start from few crucial samples, and apply a set of transform
	final long[] seeds = {
			Long.MIN_VALUE,
			Integer.MIN_VALUE,
			Short.MIN_VALUE,
			Byte.MIN_VALUE,
			-1,
			0,
			1,
			Byte.MAX_VALUE,
			Short.MAX_VALUE,
			Integer.MAX_VALUE,
			Long.MAX_VALUE
	};

	final ArrayList<Long> longs = new ArrayList<Long>();
	for( final long seed : seeds ) {
		longs.add( seed );
	}

	for( final Long l : new ArrayList<Long>( longs ) ) {
		for( int i = Byte.MIN_VALUE; i < Byte.MAX_VALUE; i++ ) {
			longs.add( l + i );
		}
	}

	return longs.toArray( new Long[0] );
}
 
源代码26 项目: gflogger   文件: BufferFormatterPropertyTest.java
@DataPoints
public static char[] allOneByteChars() {
	//byte buffers support only 1-byte chars
	final char[] chars = new char[0xff];
	for( int i = 0; i < chars.length; i++ ) {
		chars[i] = ( char ) i;
	}

	return chars;
}
 
源代码27 项目: gflogger   文件: BufferFormatterPropertyTest.java
@DataPoints
public static byte[] allBytes() {
	final byte[] bytes = new byte[255];
	for( int i = 0; i < bytes.length; i++ ) {
		bytes[i] = ( byte ) ( i + Byte.MIN_VALUE );
	}
	return bytes;
}
 
源代码28 项目: artio   文件: MonthYearTest.java
@DataPoints("validMonthYears")
public static Iterable<Object[]> validMonthYears()
{
    return Arrays.asList(
        new Object[]{ "000101", MonthYear.of(1, JANUARY) },
        new Object[]{ "201502", MonthYear.of(2015, FEBRUARY) },
        new Object[]{ "999912", MonthYear.of(9999, DECEMBER) }
    );
}
 
源代码29 项目: artio   文件: MonthYearTest.java
@DataPoints("validMonthYearsWithDay")
public static Iterable<Object[]> validMonthYearsWithDay()
{
    return Arrays.asList(
        new Object[]{ "00010101", MonthYear.withDayOfMonth(1, JANUARY, 1) },
        new Object[]{ "20150225", MonthYear.withDayOfMonth(2015, FEBRUARY, 25) },
        new Object[]{ "99991231", MonthYear.withDayOfMonth(9999, DECEMBER, 31) }
    );
}
 
源代码30 项目: artio   文件: MonthYearTest.java
@DataPoints("validMonthYearsWithWeek")
public static Iterable<Object[]> validMonthYearsWithWeek()
{
    return Arrays.asList(
        new Object[]{ "000101w1", MonthYear.withWeekOfMonth(1, JANUARY, 1) },
        new Object[]{ "201502w5", MonthYear.withWeekOfMonth(2015, FEBRUARY, 5) },
        new Object[]{ "999912w3", MonthYear.withWeekOfMonth(9999, DECEMBER, 3) }
    );
}
 
 类所在包
 同包方法