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


Java TestWith类代码示例

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


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

示例1: toJsonObject_whenMultiMapWithMultipleEntries_expectJsonObjectWithJsonArrays

import com.googlecode.zohhak.api.TestWith; //导入依赖的package包/类
@TestWith({
    "mapKey1:A,B,C;{\"mapKey1\":[\"A\",\"B\",\"C\"]}",
    "mapKey1:A,B,C,D;{\"mapKey1\":[\"A\",\"B\",\"C\",\"D\"]}",
    "mapKey1:A,B,C,D,E;{\"mapKey1\":[\"A\",\"B\",\"C\",\"D\",\"E\"]}",
    "mapKey1:A|mapKey2:B;{\"mapKey1\":[\"A\"],\"mapKey2\":[\"B\"]}",
    "mapKey1:A|mapKey2:B|mapKey3:C;{\"mapKey1\":[\"A\"],\"mapKey2\":[\"B\"],\"mapKey3\":[\"C\"]}",
    "mapKey1:A,B|mapKey2:C,D|mapKey3:E,F;{\"mapKey1\":[\"A\",\"B\"],\"mapKey2\":[\"C\",\"D\"],\"mapKey3\":[\"E\",\"F\"]}",
    "mapKey1:A,B,C|mapKey2:A,B,C|mapKey3:A,B,C;{\"mapKey1\":[\"A\",\"B\",\"C\"],\"mapKey2\":[\"A\",\"B\",\"C\"],\"mapKey3\":[\"A\",\"B\",\"C\"]}"
})
public void toJsonObject_whenMultiMapWithMultipleEntries_expectJsonObjectWithJsonArrays(
    MultiMap multiMap, String expectedJson) throws Exception {
  JsonObject jsonObject = MultiMapConverter.toJsonObject(multiMap);
  assertThat(
      jsonObject.toString(),
      sameJSONAs(expectedJson).allowingAnyArrayOrdering());
}
 
开发者ID:Cognifide,项目名称:knotx,代码行数:17,代码来源:MultiMapConverterTest.java

示例2: shouldParseToProperNamespaceAndPathObjects

import com.googlecode.zohhak.api.TestWith; //导入依赖的package包/类
@TestWith({
    "Facebook : Work /            | Facebook | Work/",
    "Standard Tags/               |          | Standard Tags/",
    "Facebook : Work / Employer / | Facebook | Work/Employer/",
    "                             |          | Standard Tags/",
    "null                         |          | Standard Tags/"
})
public void shouldParseToProperNamespaceAndPathObjects(String givenNamespaceAndPath,
    String expectedNamespace, String expectedPath) {
  // When
  NamespaceAndPath result = tested.getNamespaceAndPath(givenNamespaceAndPath);

  // Then
  assertEquals(expectedNamespace, result.getNamespace());
  assertEquals(expectedPath, result.getPath());
}
 
开发者ID:Cognifide,项目名称:bobcat,代码行数:17,代码来源:NamespaceAndPathSplitterTest.java

示例3: checkMultisetsIndices

import com.googlecode.zohhak.api.TestWith; //导入依赖的package包/类
@TestWith("10, 5, 20, 6")
public void checkMultisetsIndices(int nbOfChar1, int nbOfPropagatedChar1, int nbOfChar2, int nbOfPropagatedChar2) throws IOException {
  // given
  ImageText imageText = new ImageText();
  imageText.setTextElements(buildTextElementsWithChars(CHAR_1, nbOfChar1, nbOfPropagatedChar1, CHAR_2, nbOfChar2, nbOfPropagatedChar2));
  MultiSetsBuilder multiSetsBuilder = new MultiSetsBuilder(true, CLASS_SIZE_MIN_DEFAULT);

  // when
  MultiSets multiSets = multiSetsBuilder.build(imageText);
  DigitalTypeIndices digitalTypeIndices1 = multiSets.get(0).getDigitalTypeIndices();
  DigitalTypeIndices digitalTypeIndices2 = multiSets.get(1).getDigitalTypeIndices();

  // then
  IntStream.range(0, nbOfChar1 + nbOfPropagatedChar1).forEach(i ->
          Assertions.assertThat(digitalTypeIndices1.get(i)).isEqualTo(i)
  );
  IntStream.range(0, nbOfChar2 + nbOfPropagatedChar2).forEach(i ->
          Assertions.assertThat(digitalTypeIndices2.get(i)).isEqualTo(i + nbOfChar1 + nbOfPropagatedChar1)
  );
}
 
开发者ID:Orange-OpenSource,项目名称:documentare-simdoc,代码行数:21,代码来源:MultiSetsBuilderTest.java

示例4: compute_graph_with_scut

import com.googlecode.zohhak.api.TestWith; //导入依赖的package包/类
@TestWith({"false, 3, 1, 2", "false, 1.96, 3, 3", "true, 3, 3, 3"})
public void compute_graph_with_scut(boolean sloop, float scut, int subGraphsNb, int clustersNb) {
  // given
  ClusteringItem[] clusteringItems = Item.buildClusteringItems(this, 6);
  ClusteringGraphBuilder clusteringGraphBuilder = new ClusteringGraphBuilder();
  ClusteringParameters parameters = sloop ?
    ClusteringParameters.builder().scut(scut).sloop().build() :
    ClusteringParameters.builder().scut(scut).build();

  // do
  ClusteringGraph clusteringGraph =
    clusteringGraphBuilder.buildGraphAndUpdateClusterIdAndCenter(clusteringItems, parameters);

  // then
  Map<Integer, SubGraph> subGraphs = clusteringGraph.getSubGraphs();
  Map<Integer, GraphCluster> clusters = clusteringGraph.getClusters();
  Assertions.assertThat(subGraphs).hasSize(subGraphsNb);
  Assertions.assertThat(clusters).hasSize(clustersNb);
}
 
开发者ID:Orange-OpenSource,项目名称:documentare-simdoc,代码行数:20,代码来源:ClusteringGraphBuilderScalpelTest.java

示例5: check_items_are_in_correct_cluster

import com.googlecode.zohhak.api.TestWith; //导入依赖的package包/类
@TestWith({"false, 1.96", "true, 3"})
public void check_items_are_in_correct_cluster(boolean sloop, float scut) {
  // given
  ClusteringItem[] clusteringItems = Item.buildClusteringItems(this, 6);
  ClusteringGraphBuilder clusteringGraphBuilder = new ClusteringGraphBuilder();
  ClusteringParameters parameters = sloop ?
    ClusteringParameters.builder().scut(scut).sloop().build() :
    ClusteringParameters.builder().scut(scut).build();

  // do
  clusteringGraphBuilder.buildGraphAndUpdateClusterIdAndCenter(clusteringItems, parameters);

  // then
  Assertions.assertThat(clusteringItems[0].getClusterId()).isEqualTo(1);
  Assertions.assertThat(clusteringItems[1].getClusterId()).isEqualTo(1);
  Assertions.assertThat(clusteringItems[2].getClusterId()).isEqualTo(1);
  Assertions.assertThat(clusteringItems[3].getClusterId()).isEqualTo(2);
  Assertions.assertThat(clusteringItems[4].getClusterId()).isEqualTo(3);
  Assertions.assertThat(clusteringItems[5].getClusterId()).isEqualTo(3);
}
 
开发者ID:Orange-OpenSource,项目名称:documentare-simdoc,代码行数:21,代码来源:ClusteringGraphBuilderScalpelTest.java

示例6: updateDigitalTypesClusterId

import com.googlecode.zohhak.api.TestWith; //导入依赖的package包/类
@TestWith({
        "/latin_segmentation.reference.json.gz, /latin_segmentation_with_cluster_id.reference.json.gz, latin_segmentation_distances_built_with_cluster_id.json.gz, false, false",
        "/latin_segmentation_with_distances.reference.json.gz, /latin_segmentation_with_cluster_id_and_distances.reference.json.gz, latin_segmentation_with_cluster_id.json.gz, true, true"
})
public void updateDigitalTypesClusterId(String segmentationInput, String withCLusterIdRef, String withClusterIdOutput, boolean distancesAvailable, boolean keepDistances) throws IOException {
  // given
  ImageSegmentation imageSegmentation = loadSegmentationTest(segmentationInput);
  DigitalTypes digitalTypes = imageSegmentation.getDigitalTypes();
  DigitalTypesClustering digitalTypesClustering = new DigitalTypesClustering();
  digitalTypesClustering.setProgressListener(this);
  digitalTypesClustering.setComputeDistances(!distancesAvailable);
  digitalTypesClustering.setClearDistances(!keepDistances);
  ClusteringParameters parameters = clusteringParameters();
  String outputReference = loadReference(withCLusterIdRef);

  // when
  digitalTypesClustering.computeClusterIdsOf(digitalTypes, parameters);
  imageSegmentation.setDistancesAvailable(keepDistances);
  imageSegmentation.setClustersAvailable(true);

  String outputReloaded = saveAndReloadOutput(imageSegmentation, withClusterIdOutput);

  // then
  Assertions.assertThat(outputReloaded).isEqualTo(outputReference);
}
 
开发者ID:Orange-OpenSource,项目名称:documentare-simdoc,代码行数:26,代码来源:DigitalTypesClusteringTest.java

示例7: doSegmentation

import com.googlecode.zohhak.api.TestWith; //导入依赖的package包/类
@TestWith({
        "/latin.png, /latin_segmentation.reference.json.gz, latin_segmentation.json.gz, latin_segmentation.png"
})
public void doSegmentation(String image, String refFileResource, String OutputJson, String outputImage) throws IOException {
  // given
  JsonGenericHandler jsonGenericHandler = new JsonGenericHandler(true);
  File ref = new File(getClass().getResource(refFileResource).getFile());
  String refJson = Gzip.getStringFromGzipFile(ref);
  Segmenter segmenter = new Segmenter(new File(getClass().getResource(image).getFile()));
  File outputFileImage = new File(outputImage);
  File OutputFileJson = new File(OutputJson);

  // when
  segmenter.doSegmentation();
  segmenter.drawSegmentation(outputFileImage);
  jsonGenericHandler.writeObjectToJsonGzipFile(segmenter.getImageSegmentation(), OutputFileJson);
  String outputJson = Gzip.getStringFromGzipFile(OutputFileJson);

  // then
  Assertions.assertThat(outputJson).isEqualTo(refJson);
}
 
开发者ID:Orange-OpenSource,项目名称:documentare-simdoc,代码行数:22,代码来源:SegmenterIntegrationTest.java

示例8: detectConnectedComponentsOnImage

import com.googlecode.zohhak.api.TestWith; //导入依赖的package包/类
@TestWith({
        "/latin.png, /latin_connected_components_ref.json.gz, latin_connected_components.json.gz, /latin.png, latin_connected_components.png"
})
public void detectConnectedComponentsOnImage(String image, String refFileResource, String OutputFile, String inputImage, String outputImage) throws IOException {
  // given
  JsonGenericHandler jsonGenericHandler = new JsonGenericHandler(true);
  File ccRefFile = new File(getClass().getResource(refFileResource).getFile());
  String ccRefJsonString = Gzip.getStringFromGzipFile(ccRefFile);
  File imageFile = new File(getClass().getResource(image).getFile());
  ConnectedComponentsDetector connectedComponentsDetector = new ConnectedComponentsDetector();
  File outputFile = new File(OutputFile);

  // when
  ConnectedComponents connectedComponents = connectedComponentsDetector.detect(imageFile);
  TestDrawer.draw(new File(getClass().getResource(inputImage).getFile()), new File(outputImage), new Lines(), connectedComponents);

  jsonGenericHandler.writeObjectToJsonGzipFile(connectedComponents, outputFile);
  String ccTestJsonString = Gzip.getStringFromGzipFile(outputFile);

  // then
  Assertions.assertThat(ccTestJsonString).isEqualTo(ccRefJsonString);
}
 
开发者ID:Orange-OpenSource,项目名称:documentare-simdoc,代码行数:23,代码来源:ConnectedComponentsDetectorIntegrationTest.java

示例9: buildSubColumns

import com.googlecode.zohhak.api.TestWith; //导入依赖的package包/类
@TestWith({
        "/latin_raw_lines_ref.json.gz, /latin_lines_with_columns_ref.json.gz, latin_lines_with_columns.json.gz, /latin.png, latin_lines_with_columns.png"
})
public void buildSubColumns(String linesFileResource, String refFileResource, String outputLines, String inputImage, String outputImage) throws IOException {
  // given
  JsonGenericHandler jsonGenericHandler = new JsonGenericHandler(true);
  File linesFile = new File(getClass().getResource(linesFileResource).getFile());
  Lines rawLines = (Lines) jsonGenericHandler.getObjectFromJsonGzipFile(Lines.class, linesFile);

  File ccRefFile = new File(getClass().getResource(refFileResource).getFile());
  String ccRefJsonString = Gzip.getStringFromGzipFile(ccRefFile);

  SubColumnsBuilder subColumnsBuilder = new SubColumnsBuilder();
  File outputFile = new File(outputLines);

  // when
  Lines linesWithColumns = subColumnsBuilder.build(rawLines, false);
  TestDrawer.drawLines(new File(getClass().getResource(inputImage).getFile()), new File(outputImage), linesWithColumns);

  jsonGenericHandler.writeObjectToJsonGzipFile(linesWithColumns, outputFile);
  String ccTestJsonString = Gzip.getStringFromGzipFile(outputFile);

  // then
  Assertions.assertThat(ccTestJsonString).isEqualTo(ccRefJsonString);
}
 
开发者ID:Orange-OpenSource,项目名称:documentare-simdoc,代码行数:26,代码来源:SubColumnsBuilderTest.java

示例10: buildRawLines

import com.googlecode.zohhak.api.TestWith; //导入依赖的package包/类
@TestWith({
        "/latin_connected_components_ref.json.gz, /latin_raw_lines_ref.json.gz, latin_raw_lines.json.gz, /latin.png, latin_raw_lines.png"
})
public void buildRawLines(String connectedComponentsFileResource, String refFileResource, String outputLines, String inputImage, String outputImage) throws IOException {
  // given
  JsonGenericHandler jsonGenericHandler = new JsonGenericHandler(true);
  File connectedComponentsFile = new File(getClass().getResource(connectedComponentsFileResource).getFile());
  ConnectedComponents connectedComponents = (ConnectedComponents) jsonGenericHandler.getObjectFromJsonGzipFile(ConnectedComponents.class, connectedComponentsFile);

  File ccRefFile = new File(getClass().getResource(refFileResource).getFile());
  String ccRefJsonString = Gzip.getStringFromGzipFile(ccRefFile);

  RawLinesBuilder rawLinesBuilder = new RawLinesBuilder(Integer.MAX_VALUE);
  File outputFile = new File(outputLines);

  // when
  Lines rawlines = rawLinesBuilder.build(connectedComponents);
  TestDrawer.drawLines(new File(getClass().getResource(inputImage).getFile()), new File(outputImage), rawlines);

  jsonGenericHandler.writeObjectToJsonGzipFile(rawlines, outputFile);
  String ccTestJsonString = Gzip.getStringFromGzipFile(outputFile);

  // then
  Assertions.assertThat(ccTestJsonString).isEqualTo(ccRefJsonString);
}
 
开发者ID:Orange-OpenSource,项目名称:documentare-simdoc,代码行数:26,代码来源:RawLinesBuilderTest.java

示例11: supported_image_extension

import com.googlecode.zohhak.api.TestWith; //导入依赖的package包/类
@TestWith({
        "file.pnG, true",
        "file.jpG, true",
        "file.jpEg, true",
        "file.tiF, true",
        "file.tiFf, true",
        "file.pDf, true",

        "png.f, false",
        "jpg.f, false",
        "jpeg.f, false",
        "tif.f, false",
        "tiff.f, false",
        "pdf.f, false"
})
public void supported_image_extension(String filename, boolean expectedSupported) throws IOException {
  // when
  boolean supported = Thumbnail.canCreateThumbnail(new File(filename));
  // then
  Assertions.assertThat(supported).isEqualTo(expectedSupported);
}
 
开发者ID:Orange-OpenSource,项目名称:documentare-simdoc,代码行数:22,代码来源:ThumbnailTest.java

示例12: evaluate_whenOnlyOneSuite_expectFalseNoMatterConditions

import com.googlecode.zohhak.api.TestWith; //导入依赖的package包/类
@TestWith({
    //1 suite, remove all but last version in all cases
    "A-1 ; null ; 1 ; A-1 ; 10",
    "A-1 ; null ; null ; A-1 ; 10",
    "A-1 ; 100 ; 1 ; A-1; 10",
    "A-1 ; 100 ; null ; A-1 ; 10"
})
public void evaluate_whenOnlyOneSuite_expectFalseNoMatterConditions(String allSuitesVersions,
    Long removeOlderThan,
    Long keepNVersions, String evaluatedSuite, Integer createdDaysAgo) throws Exception {
  final List<Suite> suites = SUITES_LIST_COERCER.toList(allSuitesVersions);

  SuiteRemoveCondition condition = new SuiteRemoveCondition(suites,
      mockRemoveConditions(removeOlderThan, keepNVersions));
  final boolean remove = condition
      .evaluate(mockSuiteVersionAndCreatedDate(evaluatedSuite, createdDaysAgo));
  assertFalse(remove);
}
 
开发者ID:Cognifide,项目名称:aet,代码行数:19,代码来源:SuiteRemoveConditionTest.java

示例13: evaluate_when8SuitesKeepNewerThan_expectFalse

import com.googlecode.zohhak.api.TestWith; //导入依赖的package包/类
@TestWith({
    //8 suites, keep newer than 4 days
    "A-1,A-2,B-3,B-4,C-5,C-6,D-7,E-8 ; 4 ; null ; C-6 ; 3",
    "A-1,A-2,B-3,B-4,C-5,C-6,D-7,E-8 ; 4 ; null ; D-7 ; 2",
    "A-1,A-2,B-3,B-4,C-5,C-6,D-7,E-8 ; 4 ; null ; E-8 ; 1",
    //8 suites, remove older than 1 day but keep at least one version
    "A-1,A-2,B-3,B-4,C-5,C-6,D-7,E-8 ; 1 ; null ; E-8 ; 1"
})
public void evaluate_when8SuitesKeepNewerThan_expectFalse(String allSuitesVersions, Long
    removeOlderThan, Long keepNVersions, String evaluatedSuite, Integer createdDaysAgo)
    throws Exception {
  final List<Suite> suites = SUITES_LIST_COERCER.toList(allSuitesVersions);

  SuiteRemoveCondition condition = new SuiteRemoveCondition(suites,
      mockRemoveConditions(removeOlderThan, keepNVersions));
  final boolean remove = condition
      .evaluate(mockSuiteVersionAndCreatedDate(evaluatedSuite, createdDaysAgo));
  assertFalse(remove);
}
 
开发者ID:Cognifide,项目名称:aet,代码行数:20,代码来源:SuiteRemoveConditionTest.java

示例14: evaluate_when8SuitesKeepNewerThanAndAtLeastXVersions_expectTrue

import com.googlecode.zohhak.api.TestWith; //导入依赖的package包/类
@TestWith({
    //8 suites, keep newer than 4 days but at least 4 last versions
    "A-1,A-2,B-3,B-4,C-5,C-6,D-7,E-8 ; 4 ; 4 ; A-1 ; 8",
    "A-1,A-2,B-3,B-4,C-5,C-6,D-7,E-8 ; 4 ; 4 ; A-2 ; 7",
    "A-1,A-2,B-3,B-4,C-5,C-6,D-7,E-8 ; 4 ; 4 ; B-3 ; 6",
    "A-1,A-2,B-3,B-4,C-5,C-6,D-7,E-8 ; 4 ; 4 ; B-4 ; 5"
})
public void evaluate_when8SuitesKeepNewerThanAndAtLeastXVersions_expectTrue(
    String allSuitesVersions, Long
    removeOlderThan, Long keepNVersions, String evaluatedSuite, Integer createdDaysAgo)
    throws Exception {
  final List<Suite> suites = SUITES_LIST_COERCER.toList(allSuitesVersions);

  SuiteRemoveCondition condition = new SuiteRemoveCondition(suites,
      mockRemoveConditions(removeOlderThan, keepNVersions));
  final boolean remove = condition
      .evaluate(mockSuiteVersionAndCreatedDate(evaluatedSuite, createdDaysAgo));
  assertTrue(remove);
}
 
开发者ID:Cognifide,项目名称:aet,代码行数:20,代码来源:SuiteRemoveConditionTest.java

示例15: evaluate_when8SuitesKeepNewerThanAndAtLeastXVersions_expectFalse

import com.googlecode.zohhak.api.TestWith; //导入依赖的package包/类
@TestWith({
    //8 suites, keep newer than 4 days but at least 4 last versions
    "A-1,A-2,B-3,B-4,C-5,C-6,D-7,E-8 ; 4 ; 4 ; C-5 ; 4",
    "A-1,A-2,B-3,B-4,C-5,C-6,D-7,E-8 ; 4 ; 4 ; C-6 ; 3",
    "A-1,A-2,B-3,B-4,C-5,C-6,D-7,E-8 ; 4 ; 4 ; D-7 ; 2",
    "A-1,A-2,B-3,B-4,C-5,C-6,D-7,E-8 ; 4 ; 4 ; E-8 ; 1"
})
public void evaluate_when8SuitesKeepNewerThanAndAtLeastXVersions_expectFalse(
    String allSuitesVersions,
    Long removeOlderThan, Long keepNVersions, String evaluatedSuite, Integer createdDaysAgo)
    throws Exception {
  final List<Suite> suites = SUITES_LIST_COERCER.toList(allSuitesVersions);

  SuiteRemoveCondition condition = new SuiteRemoveCondition(suites,
      mockRemoveConditions(removeOlderThan, keepNVersions));
  final boolean remove = condition
      .evaluate(mockSuiteVersionAndCreatedDate(evaluatedSuite, createdDaysAgo));
  assertFalse(remove);
}
 
开发者ID:Cognifide,项目名称:aet,代码行数:20,代码来源:SuiteRemoveConditionTest.java


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