當前位置: 首頁>>代碼示例>>Java>>正文


Java DataPoints類代碼示例

本文整理匯總了Java中org.junit.experimental.theories.DataPoints的典型用法代碼示例。如果您正苦於以下問題:Java DataPoints類的具體用法?Java DataPoints怎麽用?Java DataPoints使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DataPoints類屬於org.junit.experimental.theories包,在下文中一共展示了DataPoints類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFixture

import org.junit.experimental.theories.DataPoints; //導入依賴的package包/類
/**
 * 正常係テストデータ. 正常なレンジヘッダフィールドが指定された場合のテスト
 * @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;
}
 
開發者ID:personium,項目名稱:personium-core,代碼行數:27,代碼來源:RangeHeaderHandlerTest.java

示例2: guilds

import org.junit.experimental.theories.DataPoints; //導入依賴的package包/類
@DataPoints
public static Card[] guilds() {
    BonusPerBoardElement bonus = new BonusPerBoardElement();
    bonus.setType(BoardElementType.CARD);
    bonus.setColors(Arrays.asList(Color.GREY, Color.BROWN));
    bonus.setBoards(Arrays.asList(RelativeBoardPosition.LEFT, RelativeBoardPosition.RIGHT));
    bonus.setPoints(1);

    BonusPerBoardElement bonus2 = new BonusPerBoardElement();
    bonus2.setType(BoardElementType.BUILT_WONDER_STAGES);
    bonus2.setBoards(
            Arrays.asList(RelativeBoardPosition.LEFT, RelativeBoardPosition.SELF, RelativeBoardPosition.RIGHT));
    bonus2.setPoints(1);

    return new Card[] {TestUtils.createGuildCard(1, bonus), TestUtils.createGuildCard(2, bonus2)};
}
 
開發者ID:luxons,項目名稱:seven-wonders,代碼行數:17,代碼來源:SpecialAbilityActivationTest.java

示例3: getSampleData

import org.junit.experimental.theories.DataPoints; //導入依賴的package包/類
@DataPoints
public static String[][] getSampleData() {
  return new String[][]{
      {"lineA", "lineA"},
      {"lineB\n", "lineB\n"},
      {"\nlineC\n", "lineC\n"},
      {"\n\n\nlineD\n", "lineD\n"},
      {"firstA\n\n\nlast", "firstA\nlast"},
      {"firstB\n\n\nsecond\n\n\n\n\n\nlast", "firstB\nsecond\nlast"},
      {"firstC\n\n\nlast\n\n", "firstC\nlast\n"},
      // CRLF
      {"Crlf lineA\r\n\r\nsecond line", "Crlf lineA\r\nsecond line"},
      {"Crlf lineB\r\n\r\nsecond line\r\n\r\n", "Crlf lineB\r\nsecond line\r\n"},
      // mixed
      {"Crlf lineC\n\n\nsecond line\r\n\r\n", "Crlf lineC\nsecond line\r\n"},
  };
}
 
開發者ID:Cognifide,項目名稱:aet,代碼行數:18,代碼來源:SourceComparatorRegExpTest.java

示例4: getBatches

import org.junit.experimental.theories.DataPoints; //導入依賴的package包/類
@DataPoints
public static BatchTest[] getBatches() {
    List<BatchTest> result = new ArrayList<BatchTest>();
    BatchTest test = new BatchTest();
    test.contentType = ContentType.XML;
    test.stream = BulkApiBatchIntegrationTest.class.getResourceAsStream(TEST_REQUEST_XML);
    result.add(test);

    test = new BatchTest();
    test.contentType = ContentType.CSV;
    test.stream = BulkApiBatchIntegrationTest.class.getResourceAsStream(TEST_REQUEST_CSV);
    result.add(test);

    // TODO test ZIP_XML and ZIP_CSV
    return result.toArray(new BatchTest[result.size()]);
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:17,代碼來源:BulkApiBatchIntegrationTest.java

示例5: valuesAndLengths

import org.junit.experimental.theories.DataPoints; //導入依賴的package包/類
@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},
    };
}
 
開發者ID:real-logic,項目名稱:artio,代碼行數:19,代碼來源:MutableAsciiBufferTest.java

示例6: urls

import org.junit.experimental.theories.DataPoints; //導入依賴的package包/類
@DataPoints
public static String[] urls() throws Exception {
    // Load examples
    try (InputStream in = OEmbedExamplesTest.class.getResourceAsStream("examples.json")) {
        ObjectMapper mapper = new ObjectMapper();
        TypeFactory tf = mapper.getTypeFactory();
        examples = mapper.readValue(in, tf.constructMapType(Map.class, tf.constructType(String.class),
                tf.constructCollectionType(List.class, String.class)));
    }

    List<String> result = new ArrayList<>();
    urlToProviderName = new HashMap<>();
    for (Map.Entry<String, List<String>> e : examples.entrySet()) {
        for (String url : e.getValue()) {
            HttpUrl b = HttpUrl.parse(url);
            String v = b.queryParameter("url");
            if (v != null) {
                urlToProviderName.put(v, e.getKey());
                result.add(v);
            }
        }
    }

    return result.toArray(new String[result.size()]);
}
 
開發者ID:vnesek,項目名稱:nmote-oembed,代碼行數:26,代碼來源:OEmbedExamplesTest.java

示例7: data

import org.junit.experimental.theories.DataPoints; //導入依賴的package包/類
@DataPoints
public static TestPair[] data() {
    int counter = 1;
    return new TestPair[] {
        new TestPair(counter++, atom("foo")),
        new TestPair(counter++, list("foo")),
        new TestPair(counter++, list("foo", list("bar", atom("baz")), atom("foof"))),
        new TestPair(counter++, list("foo",  atom("baz"))),
        new TestPair(counter++, list("fo\"o",  atom("baz"))),
        new TestPair(counter++, list("fo-o",  atom("baz"))),
        new TestPair(counter++, list("foo bar",  atom("baz"))),
        new TestPair(counter++, list("\0x80fsssssssssssssoo bar",  atom("baz"))),
        new TestPair(counter++, atom("foo-bar")),
        new TestPair(counter++, atom("-")),
        new TestPair(counter++, atom("includes ~ tilde")),
    };
}
 
開發者ID:lshift,項目名稱:bletchley,代碼行數:18,代碼來源:PrettyPrinterTest.java

示例8: addMultiPointMethods

import org.junit.experimental.theories.DataPoints; //導入依賴的package包/類
private void addMultiPointMethods(ParameterSignature sig, List<PotentialAssignment> list) throws Throwable {
    for (FrameworkMethod dataPointsMethod : getDataPointsMethods(sig)) {
        Class<?> returnType = dataPointsMethod.getReturnType();
        
        if ((returnType.isArray() && sig.canPotentiallyAcceptType(returnType.getComponentType())) ||
                Iterable.class.isAssignableFrom(returnType)) {
            try {
                addDataPointsValues(returnType, sig, dataPointsMethod.getName(), list, 
                        dataPointsMethod.invokeExplosively(null));
            } catch (Throwable throwable) {
                DataPoints annotation = dataPointsMethod.getAnnotation(DataPoints.class);
                if (annotation != null && isAssignableToAnyOf(annotation.ignoredExceptions(), throwable)) {
                    return;
                } else {
                    throw throwable;
                }
            }
        }
    }
}
 
開發者ID:DIVERSIFY-project,項目名稱:sosiefier,代碼行數:21,代碼來源:AllMembersSupplier.java

示例9: getDataPointsFields

import org.junit.experimental.theories.DataPoints; //導入依賴的package包/類
@Override
protected Collection<Field> getDataPointsFields(ParameterSignature sig) {
    Collection<Field> fields = super.getDataPointsFields(sig);        
    String requestedName = sig.getAnnotation(FromDataPoints.class).value();
    
    List<Field> fieldsWithMatchingNames = new ArrayList<Field>();
    
    for (Field field : fields) {
        String[] fieldNames = field.getAnnotation(DataPoints.class).value();
        if (Arrays.asList(fieldNames).contains(requestedName)) {
            fieldsWithMatchingNames.add(field);
        }
    }
    
    return fieldsWithMatchingNames;
}
 
開發者ID:DIVERSIFY-project,項目名稱:sosiefier,代碼行數:17,代碼來源:SpecificDataPointsSupplier.java

示例10: getDataPointsMethods

import org.junit.experimental.theories.DataPoints; //導入依賴的package包/類
@Override
protected Collection<FrameworkMethod> getDataPointsMethods(ParameterSignature sig) {
    Collection<FrameworkMethod> methods = super.getDataPointsMethods(sig);
    String requestedName = sig.getAnnotation(FromDataPoints.class).value();
    
    List<FrameworkMethod> methodsWithMatchingNames = new ArrayList<FrameworkMethod>();
    
    for (FrameworkMethod method : methods) {
        String[] methodNames = method.getAnnotation(DataPoints.class).value();
        if (Arrays.asList(methodNames).contains(requestedName)) {
            methodsWithMatchingNames.add(method);
        }
    }
    
    return methodsWithMatchingNames;
}
 
開發者ID:DIVERSIFY-project,項目名稱:sosiefier,代碼行數:17,代碼來源:SpecificDataPointsSupplier.java

示例11: cipherTexts

import org.junit.experimental.theories.DataPoints; //導入依賴的package包/類
@DataPoints
public static List<TestCyphertext> cipherTexts() throws
    URISyntaxException, FileNotFoundException, IOException {
  JsonObject json = Utils.loadJsonResource("/wallet_ciphertexts.json");
  JsonArray jsonCiphertexts = json.getAsJsonArray("ciphertexts");
  ArrayList<TestCyphertext> ciphertexts = new ArrayList<>();
  for (JsonElement e : jsonCiphertexts) {
    JsonObject obj = e.getAsJsonObject();
    TestCyphertext ciphertext = new TestCyphertext();
    ciphertext.passphrase = obj.get("passphrase").getAsString();
    ciphertext.cleartext = obj.get("cleartext").getAsString();
    ciphertext.encrypted = EncryptedMessage.fromJson(obj.get("encrypted").getAsJsonObject());
    ciphertexts.add(ciphertext);
  }

  return ciphertexts;
}
 
開發者ID:GemHQ,項目名稱:round-java,代碼行數:18,代碼來源:PassphraseBoxTest.java

示例12: globs

import org.junit.experimental.theories.DataPoints; //導入依賴的package包/類
@DataPoints({"globs"})
public static MatchData[] globs() {
  final ImmutableList.Builder<MatchData> builder = ImmutableList.<MatchData>builder()
      .add(MatchData.of("glob:*", false, false, false, true, 
          assertNonNull(hasItems("dir1", "dir2"))))
      .add(MatchData.of("glob:*", false, false, true, false, 
          assertNonNull(hasItems(subFiles.toArray(new String[0])))))
      .add(MatchData.of("glob:dir2", false, false, true, true, 
          assertNonNull(everyItem(equalTo("dir2")))))
      .add(MatchData.of("glob:dir2/**/dir22?/dir*/*.*", false, false, true, false,  
          assertNonNull(everyItem(allOf(
              startsWith(toFileSystemSpecific("dir2/dir22/dir222/dir2221")),
              anyOf(endsWith("file2.txt"), endsWith("file3.ok"), endsWith("file4")),
              not(anyOf(endsWith("file4"), endsWith("file1")))
              )))));
  return assertNonNull(builder.build().toArray(new MatchData[0]));
}
 
開發者ID:protobufel,項目名稱:protobuf-el,代碼行數:18,代碼來源:GlobFilterTheoriesTest.java

示例13: addFields

import org.junit.experimental.theories.DataPoints; //導入依賴的package包/類
private void addFields(ParameterSignature sig,
        List<PotentialAssignment> list) {
    for (final Field field : fClass.getJavaClass().getFields()) {
        if (Modifier.isStatic(field.getModifiers())) {
            Class<?> type = field.getType();
            if (sig.canAcceptArrayType(type)
                    && field.getAnnotation(DataPoints.class) != null) {
                try {
                    addArrayValues(field.getName(), list, getStaticFieldValue(field));
                } catch (Throwable e) {
                    // ignore and move on
                }
            } else if (sig.canAcceptType(type)
                    && field.getAnnotation(DataPoint.class) != null) {
                list.add(PotentialAssignment
                        .forValue(field.getName(), getStaticFieldValue(field)));
            }
        }
    }
}
 
開發者ID:lcm-proj,項目名稱:lcm,代碼行數:21,代碼來源:AllMembersSupplier.java

示例14: getFullyCompatibleData

import org.junit.experimental.theories.DataPoints; //導入依賴的package包/類
@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),
    };
}
 
開發者ID:ligasgr,項目名稱:intellij-xquery,代碼行數:27,代碼來源:RunnerAppTest.java

示例15: getSaxonCompatibleData

import org.junit.experimental.theories.DataPoints; //導入依賴的package包/類
@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),
    };
}
 
開發者ID:ligasgr,項目名稱:intellij-xquery,代碼行數:21,代碼來源:SaxonRunnerAppTest.java


注:本文中的org.junit.experimental.theories.DataPoints類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。