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


Java DataProvider类代码示例

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


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

示例1: locales

import org.testng.annotations.DataProvider; //导入依赖的package包/类
@DataProvider
public static Iterator<Object[]> locales() {
    List<Object[]> data = new ArrayList<>();
    data.add(new String[]{"ja"});
    data.add(new String[]{"ja_JP.PCK"});
    data.add(new String[]{"ja_JP.eucJP"});
    return data.iterator();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:SJISMappingPropTest.java

示例2: outgoingData

import org.testng.annotations.DataProvider; //导入依赖的package包/类
@DataProvider(name = "outgoingData", parallel = true)
public static Iterator<Object[]> outgoingData() {
    List<Integer> leading  = of(0, 1, 17, 125);
    List<Integer> trailing = of(0, 1, 19, 123);
    List<Integer> sizes    = of(0, 1, 2, 17, 32, 64, 122, 123, 124, 125, 126, 127, 128, 256);
    List<Boolean> direct   = of(true, false);
    List<Boolean> readonly = of(false); // TODO: return readonly (true)
    F5<Integer, Integer, Integer, Boolean, Boolean, Object[]> f =
            (l, t, s, d, r) -> {
                ByteBuffer b;
                if (d) {
                    b = ByteBuffer.allocateDirect(l + t + s);
                } else {
                    b = ByteBuffer.allocate(l + t + s);
                }
                fill(b);
                if (r) {
                    b = b.asReadOnlyBuffer();
                }
                b.position(l).limit(l + s);
                return new ByteBuffer[]{b};
            };
    Iterator<Object[]> product = cartesianIterator(leading, trailing, sizes, direct, readonly, f);
    Iterator<Object[]> i = iteratorOf1(new Object[]{null});
    return concat(iteratorOf(i, product));
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:DataProviders.java

示例3: uriDataProvider

import org.testng.annotations.DataProvider; //导入依赖的package包/类
@DataProvider
Object[][] uriDataProvider() {
    return new Object[][] {

            { "/v1/site/123", new UriTemplate("/v1{attribute_uri}"), "/site/123" },
            { "/v1/site/123/asset/345", new UriTemplate("/v1{attribute_uri}/asset/345"), "/site/123" },
            { "/v1/site/123/asset/345", new UriTemplate("/v1{attribute_uri}/asset/{site_id}"), "/site/123" },
            { "/v1/site/123/asset/345", new UriTemplate("/v1/site/123{attribute_uri}"), "/asset/345" },
            { "/v1/site/123/asset/345", new UriTemplate("/v1{attribute_uri}"), "/site/123/asset/345" },

            { "/v1/site/123/asset/345/report", new UriTemplate("/v1{attribute_uri}/report"),
                    "/site/123/asset/345" },

            // template doesnt match uri
            { "/v1/site/123/asset/345/report", new UriTemplate("/v2{attribute_uri}"), null },
            // no attribute_uri variable in template
            { "/v1/site/123/asset/345/report", new UriTemplate("/v1{non_existent_variable}"), null },
            // multiple attribute_uri variables in template
            { "/v1/site/123/asset/345", new UriTemplate("/v1{attribute_uri}/{attribute_uri}"), "345" }, };
}
 
开发者ID:eclipse,项目名称:keti,代码行数:21,代码来源:UriTemplateVariableResolverTest.java

示例4: getFloatData

import org.testng.annotations.DataProvider; //导入依赖的package包/类
@DataProvider
public static Object[][] getFloatData() {
  return new Object[][] {{1.0f, CompareOp.EQUAL, 1.0f, true},
      {1.0f, CompareOp.NOT_EQUAL, 1.0f, false},
      {Float.MAX_VALUE, CompareOp.EQUAL, Float.MAX_VALUE, true},
      {Float.MIN_VALUE, CompareOp.EQUAL, Float.MIN_VALUE, true},
      {Float.MAX_VALUE, CompareOp.NOT_EQUAL, Float.MAX_VALUE, false},
      {Float.MIN_VALUE, CompareOp.NOT_EQUAL, Float.MIN_VALUE, false},
      {Float.MAX_VALUE, CompareOp.LESS_OR_EQUAL, Float.MAX_VALUE, true},
      {Float.MAX_VALUE, CompareOp.LESS, Float.MAX_VALUE, false},
      {Float.MAX_VALUE, CompareOp.GREATER_OR_EQUAL, 0f, false},
      {Float.MIN_VALUE, CompareOp.LESS, 0f, true}, {2f, CompareOp.LESS_OR_EQUAL, 0f, true},
      {Float.MAX_VALUE, CompareOp.LESS_OR_EQUAL, 0f, true},
      {Float.MIN_VALUE, CompareOp.GREATER_OR_EQUAL, 0f, false},
      {Float.MAX_VALUE, CompareOp.GREATER, Float.MAX_VALUE - 1, false},
      {Float.MIN_VALUE, CompareOp.LESS, Float.MIN_VALUE + 1, false},
      {null, CompareOp.LESS, null, false}, {null, CompareOp.GREATER_OR_EQUAL, null, true},};
}
 
开发者ID:ampool,项目名称:monarch,代码行数:19,代码来源:MPredicateHelperTest.java

示例5:

import org.testng.annotations.DataProvider; //导入依赖的package包/类
@DataProvider(name="fieldUnit")
Object[][] data_fieldUnit() {
    return new Object[][] {
            {YEAR, YEARS, FOREVER},
            {MONTH_OF_YEAR, MONTHS, YEARS},
            {DAY_OF_MONTH, DAYS, MONTHS},
            {DAY_OF_WEEK, DAYS, WEEKS},
            {DAY_OF_YEAR, DAYS, YEARS},
            {HOUR_OF_DAY, HOURS, DAYS},
            {MINUTE_OF_DAY, MINUTES, DAYS},
            {MINUTE_OF_HOUR, MINUTES, HOURS},
            {SECOND_OF_DAY, SECONDS, DAYS},
            {SECOND_OF_MINUTE, SECONDS, MINUTES},
            {MILLI_OF_DAY, MILLIS, DAYS},
            {MILLI_OF_SECOND, MILLIS, SECONDS},
            {MICRO_OF_SECOND, MICROS, SECONDS},
            {MICRO_OF_DAY, MICROS, DAYS},
            {NANO_OF_SECOND, NANOS, SECONDS},
            {NANO_OF_DAY, NANOS, DAYS},

    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:23,代码来源:TCKChronoField.java

示例6:

import org.testng.annotations.DataProvider; //导入依赖的package包/类
@DataProvider(name="week")
Object[][] data_week() {
    return new Object[][] {
            {LocalDate.of(1969, 12, 29), MONDAY, 1, 1970},
            {LocalDate.of(2012, 12, 23), SUNDAY, 51, 2012},
            {LocalDate.of(2012, 12, 24), MONDAY, 52, 2012},
            {LocalDate.of(2012, 12, 27), THURSDAY, 52, 2012},
            {LocalDate.of(2012, 12, 28), FRIDAY, 52, 2012},
            {LocalDate.of(2012, 12, 29), SATURDAY, 52, 2012},
            {LocalDate.of(2012, 12, 30), SUNDAY, 52, 2012},
            {LocalDate.of(2012, 12, 31), MONDAY, 1, 2013},
            {LocalDate.of(2013, 1, 1), TUESDAY, 1, 2013},
            {LocalDate.of(2013, 1, 2), WEDNESDAY, 1, 2013},
            {LocalDate.of(2013, 1, 6), SUNDAY, 1, 2013},
            {LocalDate.of(2013, 1, 7), MONDAY, 2, 2013},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:18,代码来源:TCKIsoFields.java

示例7: unmodifiable

import org.testng.annotations.DataProvider; //导入依赖的package包/类
@DataProvider
public static Iterator<Object[]> unmodifiable() {
    return Arrays.asList(
        of("Default-wrapped ArrayList",
           () -> wrapInDefault(
               Collections.enumeration(new ArrayList<>(Arrays.asList("a")))),
           Arrays.asList("a")),

        of("Unmodifiable ArrayList",
           Collections.unmodifiableList(new ArrayList<>(Arrays.asList("a"))),
           Arrays.asList("a")),

        of("Modifiable ArrayList",
           new ArrayList<>(Arrays.asList("a")),
           Arrays.asList("a"))
    ).iterator();
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:18,代码来源:EnumerationAsIterator.java

示例8:

import org.testng.annotations.DataProvider; //导入依赖的package包/类
@DataProvider(name="sample_isoOffsetDate")
Object[][] provider_sample_isoOffsetDate() {
    return new Object[][]{
            {2008, null, null, null, null, null, DateTimeException.class},
            {null, 6, null, null, null, null, DateTimeException.class},
            {null, null, 30, null, null, null, DateTimeException.class},
            {null, null, null, "+01:00", null, null, DateTimeException.class},
            {null, null, null, null, "Europe/Paris", null, DateTimeException.class},
            {2008, 6, null, null, null, null, DateTimeException.class},
            {null, 6, 30, null, null, null, DateTimeException.class},

            {2008, 6, 30, null, null,                   null, DateTimeException.class},
            {2008, 6, 30, "+01:00", null,               "2008-06-30+01:00", null},
            {2008, 6, 30, "+01:00", "Europe/Paris",     "2008-06-30+01:00", null},
            {2008, 6, 30, null, "Europe/Paris",         null, DateTimeException.class},

            {123456, 6, 30, "+01:00", null,             "+123456-06-30+01:00", null},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:20,代码来源:TCKDateTimeFormatters.java

示例9:

import org.testng.annotations.DataProvider; //导入依赖的package包/类
@DataProvider(name="MinusDays")
Object[][] provider_minusDays_long() {
    return new Object[][] {
        {0, 0, 0},
        {0, 1, -1},
        {0, -1, 1},
        {Long.MAX_VALUE/3600/24, 0, Long.MAX_VALUE/3600/24},
        {Long.MIN_VALUE/3600/24, 0, Long.MIN_VALUE/3600/24},
        {1, 0, 1},
        {1, 1, 0},
        {1, -1, 2},
        {Long.MAX_VALUE/3600/24, 1, Long.MAX_VALUE/3600/24 - 1},
        {Long.MIN_VALUE/3600/24, -1, Long.MIN_VALUE/3600/24 + 1},
        {1, 0, 1},
        {1, 1, 0},
        {1, -1, 2},
        {-1, 0, -1},
        {-1, 1, -2},
        {-1, -1, 0},
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:22,代码来源:TCKDuration.java

示例10:

import org.testng.annotations.DataProvider; //导入依赖的package包/类
@DataProvider(name="sample_isoInstant")
Object[][] provider_sample_isoInstant() {
    return new Object[][]{
            {0, 0, "1970-01-01T00:00:00Z", null},
            {0, null, "1970-01-01T00:00:00Z", null},
            {0, -1, null, DateTimeException.class},

            {-1, 0, "1969-12-31T23:59:59Z", null},
            {1, 0, "1970-01-01T00:00:01Z", null},
            {60, 0, "1970-01-01T00:01:00Z", null},
            {3600, 0, "1970-01-01T01:00:00Z", null},
            {86400, 0, "1970-01-02T00:00:00Z", null},

            {0, 1, "1970-01-01T00:00:00.000000001Z", null},
            {0, 2, "1970-01-01T00:00:00.000000002Z", null},
            {0, 10, "1970-01-01T00:00:00.000000010Z", null},
            {0, 100, "1970-01-01T00:00:00.000000100Z", null},
    };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:TCKDateTimeFormatters.java

示例11: unknownNames

import org.testng.annotations.DataProvider; //导入依赖的package包/类
@DataProvider(name = "unknownNames")
public Object[][] unknownNames() {
    return new Object[][]{

        // source not found
        {"DoesNotExist=m2",    "WARNING: Unknown module: DoesNotExist specified to --add-reads"},

        // target not found
        {"m2=DoesNotExist",    "WARNING: Unknown module: DoesNotExist specified to --add-reads"},

        // bad names
        {"m*=m2",              "WARNING: Unknown module: m* specified to --add-reads"},
        {"m2=m!",              "WARNING: Unknown module: m! specified to --add-reads"},

    };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:AddReadsTestWarningError.java

示例12:

import org.testng.annotations.DataProvider; //导入依赖的package包/类
@DataProvider(name="badDates")
Object[][] data_badDates() {
    return new Object[][] {
        {1928, 0, 0},

        {1928, -1, 1},
        {1928, 0, 1},
        {1928, 14, 1},
        {1928, 15, 1},

        {1928, 1, -1},
        {1928, 1, 0},
        {1928, 1, 32},

        {1928, 12, -1},
        {1928, 12, 0},
        {1928, 12, 32},

        {1725, 2, 29},
        {500, 2, 29},
        {2100, 2, 29},

        {1872, 12, 31},     // Last day of MEIJI 5
    };
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:26,代码来源:TCKJapaneseChronology.java

示例13: provider

import org.testng.annotations.DataProvider; //导入依赖的package包/类
@DataProvider
public Object[][] provider() {
    return new Object[][] {
            new Object[] { STRING_EMPTY, "" },
            new Object[] { STRING_L1, "a" },
            new Object[] { STRING_L2, "ab" },
            new Object[] { STRING_U1, "\uFF41" },
            new Object[] { STRING_MDUPLICATE1,
                    "\uFF41a\uFF41a\uFF41a\uFF41a\uFF41a" },
            new Object[] { STRING_SUPPLEMENTARY,
                    "\uD801\uDC28\uD801\uDC29\uFF41a" },
            new Object[] { STRING_SUPPLEMENTARY_LOWERCASE,
                    "\uD801\uDC28\uD801\uDC29\uFF41a" },
            new Object[] { STRING_SUPPLEMENTARY,
                    STRING_SUPPLEMENTARY_LOWERCASE } };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:17,代码来源:ToLowerCase.java

示例14: supportURIResolver

import org.testng.annotations.DataProvider; //导入依赖的package包/类
@DataProvider(name = "supportURIResolver")
public Object[][] supportURIResolver() throws Exception {
    URI catalogFile = getClass().getResource("CatalogSupport.xml").toURI();
    URI catalogFileUri = getClass().getResource("CatalogSupport_uri.xml").toURI();
    SAXSource xslSource = new SAXSource(new InputSource(new File(xsl_doc).toURI().toASCIIString()));

    /*
     * val_test.xml has a reference to system.dtd and val_test.xsd
    */
    SAXSource ss = new SAXSource(new InputSource(xml_val_test));
    ss.setSystemId(xml_val_test_id);

    return new Object[][]{
        {catalogFile, new SAXSource(new InputSource(new File(xsl_doc).toURI().toASCIIString())),
            new StreamSource(new File(xml_doc)), "Resolved by a catalog"},
        {catalogFileUri, new SAXSource(new InputSource(new StringReader(xsl_include))),
            new StreamSource(new StringReader(xml_xsl)), null},
     };
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:CatalogTest.java

示例15: createShapes

import org.testng.annotations.DataProvider; //导入依赖的package包/类
@DataProvider(name = "shapes")
public Object[][] createShapes() {
    Stream<List<Object>> baseCases = Stream.of(
            List.of("hiZeroLowTest", (IntFunction<int[]>) this::hiZeroLowData),
            List.of("endLessThanTest", (IntFunction<int[]>) this::endLessThanData),
            List.of("highFlatLowTest", (IntFunction<int[]>) this::highFlatLowData),
            List.of("identicalTest", (IntFunction<int[]>) this::identicalData),
            List.of("sortedReversedSortedTest", (IntFunction<int[]>) this::sortedReversedSortedData),
            List.of("pairFlipTest", (IntFunction<int[]>) this::pairFlipData),
            List.of("zeroHiTest", (IntFunction<int[]>) this::zeroHiData)
    );

    // Ensure the following inequality holds for certain sizes
    // DualPivotQuicksort.QUICKSORT_THRESHOLD <= size - 1
    //   < DualPivotQuicksort.COUNTING_SORT_THRESHOLD_FOR_SHORT_OR_CHAR
    // This guarantees that code paths are taken for checking nearly sorted
    // arrays for all primitive types
    List<Integer> sizes = List.of(100, 1_000, 10_000, 1_000_000);
    return baseCases.
            flatMap(l -> sizes.stream().map(s -> append(l, s))).
            toArray(Object[][]::new);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:SortingNearlySortedPrimitive.java


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