java类org.testng.annotations.DataProvider的实例源码

XslSubstringTest.java 文件源码 项目:openjdk-jdk10 阅读 20 收藏 0 点赞 0 评论 0
@DataProvider(name = "GeneralTestsData")
private Object[][] xmls() {
    return new Object[][] {
        { "|<xsl:value-of select=\"substring('asdf',2, 1)\"/>|", "<t>|s|</t>"},
        { "|<xsl:value-of select=\"substring('asdf',2, 1 div 0)\"/>|", "<t>|sdf|</t>"},
        { "|<xsl:value-of select=\"substring('asdf',2, -0 div 0)\"/>|", "<t>||</t>" },
        { "|<xsl:value-of select=\"substring('asdf',2, 1 div 0)\"/>|", "<t>|sdf|</t>" },
        // 8076290 bug test case
        { "|<xsl:value-of select=\"substring('123', 0, 3)\"/>|", "<t>|12|</t>"},
    };
}
BasicSerialization.java 文件源码 项目:openjdk-jdk10 阅读 21 收藏 0 点赞 0 评论 0
@DataProvider(name = "Map<IntegerEnum,String>", parallel = true)
private static Iterator<Object[]> makeMaps() {
    return Arrays.asList(
        // empty
        new Object[]{"HashMap", new HashMap()},
        new Object[]{"LinkedHashMap", new LinkedHashMap()},
        new Object[]{"Collections.checkedMap(HashMap)", Collections.checkedMap(new HashMap(), IntegerEnum.class, String.class)},
        new Object[]{"Collections.synchronizedMap(HashMap)", Collections.synchronizedMap(new HashMap())},
        // null hostile
        new Object[]{"EnumMap", new EnumMap(IntegerEnum.class)},
        new Object[]{"Hashtable", new Hashtable()},
        new Object[]{"TreeMap", new TreeMap()},
        new Object[]{"ConcurrentHashMap", new ConcurrentHashMap()},
        new Object[]{"ConcurrentSkipListMap", new ConcurrentSkipListMap()},
        new Object[]{"Collections.checkedMap(ConcurrentHashMap)", Collections.checkedMap(new ConcurrentHashMap(), IntegerEnum.class, String.class)},
        new Object[]{"Collections.synchronizedMap(EnumMap)", Collections.synchronizedMap(new EnumMap(IntegerEnum.class))},
        // filled
        new Object[]{"HashMap", fillMap(new HashMap())},
        new Object[]{"LinkedHashMap", fillMap(new LinkedHashMap())},
        new Object[]{"Collections.checkedMap(HashMap)", Collections.checkedMap(fillMap(new HashMap()), IntegerEnum.class, String.class)},
        new Object[]{"Collections.synchronizedMap(HashMap)", Collections.synchronizedMap(fillMap(new HashMap()))},
        // null hostile
        new Object[]{"EnumMap", fillMap(new EnumMap(IntegerEnum.class))},
        new Object[]{"Hashtable", fillMap(new Hashtable())},
        new Object[]{"TreeMap", fillMap(new TreeMap())},
        new Object[]{"ConcurrentHashMap", fillMap(new ConcurrentHashMap())},
        new Object[]{"ConcurrentSkipListMap", fillMap(new ConcurrentSkipListMap())},
        new Object[]{"Collections.checkedMap(ConcurrentHashMap)", Collections.checkedMap(fillMap(new ConcurrentHashMap()), IntegerEnum.class, String.class)},
        new Object[]{"Collections.synchronizedMap(EnumMap)", Collections.synchronizedMap(fillMap(new EnumMap(IntegerEnum.class)))}).iterator();
}
TCKChronoLocalDateSerialization.java 文件源码 项目:jdk8u-jdk 阅读 20 收藏 0 点赞 0 评论 0
@DataProvider(name = "invalidSerialformClasses")
Object[][] invalid_serial_classes() {
    return new Object[][]{
        {JapaneseEra.class},
        {JapaneseDate.class},
        {MinguoDate.class},
        {ThaiBuddhistDate.class},
        {HijrahDate.class},
    };
}
CommonCachedRowSetTests.java 文件源码 项目:openjdk-jdk10 阅读 22 收藏 0 点赞 0 评论 0
@DataProvider(name = "rowsetUsingCoffees")
protected Object[][] rowsetUsingCoffees() throws Exception {
    RowSet rs = createCoffeesRowSet();
    return new Object[][]{
        {rs}
    };
}
MonarchRecordWriterFTableTest.java 文件源码 项目:monarch 阅读 23 收藏 0 点赞 0 评论 0
@DataProvider
public static Object[][] getKeyData() {
  return new Object[][]{
    {"non.existent.key", "application_id_00001345_0001", "application_id_00001345_0001-"},
    {MonarchRecordWriter.MAPREDUCE_TASK_ID, "", ""},
    {MonarchRecordWriter.MAPREDUCE_TASK_ID, "application00001340011", ""},
    {MonarchRecordWriter.MAPREDUCE_TASK_ID, "application_id_00001345_0011", "0011-"},
    {MonarchRecordWriter.MAPREDUCE_TASK_PARTITION, "0", "0-"},
    {MonarchRecordWriter.MAPREDUCE_TASK_PARTITION, "application_id_00001345_0011", "application_id_00001345_0011-"},
    {null, "application_id_00001345_0001", "application_id_00001345_0001-"},
  };
}
TCKLocalDate.java 文件源码 项目:jdk8u-jdk 阅读 26 收藏 0 点赞 0 评论 0
@DataProvider(name="atStartOfDay")
Object[][] data_atStartOfDay() {
    return new Object[][] {
            {LocalDate.of(2008, 6, 30), LocalDateTime.of(2008, 6, 30, 0, 0)},
            {LocalDate.of(-12, 6, 30), LocalDateTime.of(-12, 6, 30, 0, 0)},
    };
}
TCKInstant.java 文件源码 项目:jdk8u-jdk 阅读 25 收藏 0 点赞 0 评论 0
@DataProvider(name="with_longTemporalField")
Object[][] data_with_longTemporalField() {
    return new Object[][]{
            {Instant.ofEpochSecond(10, 200), ChronoField.INSTANT_SECONDS, 100, Instant.ofEpochSecond(100, 200), null},
            {Instant.ofEpochSecond(10, 200), ChronoField.INSTANT_SECONDS, 0, Instant.ofEpochSecond(0, 200), null},
            {Instant.ofEpochSecond(10, 200), ChronoField.INSTANT_SECONDS, -100, Instant.ofEpochSecond(-100, 200), null},
            {Instant.ofEpochSecond(10, 200), ChronoField.NANO_OF_SECOND, 100, Instant.ofEpochSecond(10, 100), null},
            {Instant.ofEpochSecond(10, 200), ChronoField.NANO_OF_SECOND, 0, Instant.ofEpochSecond(10), null},
            {Instant.ofEpochSecond(10, 200), ChronoField.MICRO_OF_SECOND, 100, Instant.ofEpochSecond(10, 100*1000), null},
            {Instant.ofEpochSecond(10, 200), ChronoField.MICRO_OF_SECOND, 0, Instant.ofEpochSecond(10), null},
            {Instant.ofEpochSecond(10, 200), ChronoField.MILLI_OF_SECOND, 100, Instant.ofEpochSecond(10, 100*1000*1000), null},
            {Instant.ofEpochSecond(10, 200), ChronoField.MILLI_OF_SECOND, 0, Instant.ofEpochSecond(10), null},

            {Instant.ofEpochSecond(10, 200), ChronoField.NANO_OF_SECOND, 1000000000L, null, DateTimeException.class},
            {Instant.ofEpochSecond(10, 200), ChronoField.MICRO_OF_SECOND, 1000000, null, DateTimeException.class},
            {Instant.ofEpochSecond(10, 200), ChronoField.MILLI_OF_SECOND, 1000, null, DateTimeException.class},

            {Instant.ofEpochSecond(10, 200), ChronoField.SECOND_OF_MINUTE, 1, null, DateTimeException.class},
            {Instant.ofEpochSecond(10, 200), ChronoField.SECOND_OF_DAY, 1, null, DateTimeException.class},
            {Instant.ofEpochSecond(10, 200), ChronoField.OFFSET_SECONDS, 1, null, DateTimeException.class},
            {Instant.ofEpochSecond(10, 200), ChronoField.NANO_OF_DAY, 1, null, DateTimeException.class},
            {Instant.ofEpochSecond(10, 200), ChronoField.MINUTE_OF_HOUR, 1, null, DateTimeException.class},
            {Instant.ofEpochSecond(10, 200), ChronoField.MINUTE_OF_DAY, 1, null, DateTimeException.class},
            {Instant.ofEpochSecond(10, 200), ChronoField.MILLI_OF_DAY, 1, null, DateTimeException.class},
            {Instant.ofEpochSecond(10, 200), ChronoField.MICRO_OF_DAY, 1, null, DateTimeException.class},


    };
}
TCKDateTimeFormatters.java 文件源码 项目:openjdk-jdk10 阅读 26 收藏 0 点赞 0 评论 0
@DataProvider(name="weekDate")
Iterator<Object[]> weekDate() {
    return new Iterator<Object[]>() {
        private ZonedDateTime date = ZonedDateTime.of(LocalDateTime.of(2003, 12, 29, 11, 5, 30), ZoneId.of("Europe/Paris"));
        private ZonedDateTime endDate = date.withYear(2005).withMonth(1).withDayOfMonth(2);
        private int week = 1;
        private int day = 1;

        public boolean hasNext() {
            return !date.isAfter(endDate);
        }
        public Object[] next() {
            StringBuilder sb = new StringBuilder("2004-W");
            if (week < 10) {
                sb.append('0');
            }
            sb.append(week).append('-').append(day).append(date.getOffset());
            Object[] ret = new Object[] {date, sb.toString()};
            date = date.plusDays(1);
            day += 1;
            if (day == 8) {
                day = 1;
                week++;
            }
            return ret;
        }
        public void remove() {
            throw new UnsupportedOperationException();
        }
    };
}
NodeTest.java 文件源码 项目:jdk8u-jdk 阅读 30 收藏 0 点赞 0 评论 0
@DataProvider(name = "nodes")
public Object[][] createSizes() {
    List<Object[]> params = new ArrayList<>();

    for (int size : Arrays.asList(0, 1, 4, 15, 16, 17, 127, 128, 129, 1000)) {
        Integer[] array = new Integer[size];
        for (int i = 0; i < array.length; i++) {
            array[i] = i;
        }

        List<Node<Integer>> nodes = new ArrayList<>();
        nodes.add(Nodes.node(array));
        nodes.add(Nodes.node(Arrays.asList(array)));
        nodes.add(degenerateTree(Arrays.asList(array).iterator()));
        nodes.add(tree(Arrays.asList(array), l -> Nodes.node(l.toArray(new Integer[l.size()]))));
        nodes.add(tree(Arrays.asList(array), l -> Nodes.node(l)));
        nodes.add(fill(array, Nodes.builder(array.length, LambdaTestHelpers.integerArrayGenerator)));
        nodes.add(fill(array, Nodes.builder()));

        for (int i = 0; i < nodes.size(); i++) {
            params.add(new Object[]{array, nodes.get(i)});
        }

    }

    return params.toArray(new Object[0][]);
}
TCKPeriod.java 文件源码 项目:jdk8u-jdk 阅读 28 收藏 0 点赞 0 评论 0
@DataProvider(name="BadTemporalUnit")
Object[][] data_badTemporalUnit() {
    return new Object[][] {
        {ChronoUnit.MICROS},
        {ChronoUnit.MILLIS},
        {ChronoUnit.HALF_DAYS},
        {ChronoUnit.DECADES},
        {ChronoUnit.CENTURIES},
        {ChronoUnit.MILLENNIA},
    };
}


问题


面经


文章

微信
公众号

扫码关注公众号