當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。