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


Java IsIterableWithSize类代码示例

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


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

示例1: hasData

import org.hamcrest.collection.IsIterableWithSize; //导入依赖的package包/类
/**
 * Matches the set of entries against the given set of values. The full combinatorial of values passed in is expected in the output set.
 *
 * @param rows
 *          Rows to check for.
 * @param colFs
 *          Column families to check for.
 * @param colQs
 *          Column qualifiers to check for.
 * @param colVs
 *          Column visibilities to check for.
 * @param values
 *          Values to check for.
 * @return Hamcrest matcher.
 */
@Factory
@SuppressWarnings("unchecked")
public static Matcher<Iterable<Entry<Key,Value>>> hasData(Collection<String> rows, Collection<String> colFs, Collection<String> colQs,
    Collection<String> colVs, Collection<String> values) {
  int size = rows.size() * colFs.size() * colQs.size() * colVs.size() * values.size();
  ArrayList<Matcher<? super Iterable<Entry<Key,Value>>>> matchers = new ArrayList<>(size + 1);

  matchers.add(IsIterableWithSize.iterableWithSize(size));

  for (String row : rows) {
    for (String colF : colFs) {
      for (String colQ : colQs) {
        for (String colV : colVs) {
          for (String value : values) {
            matchers.add(hasItems(equalToRow(row, colF, colQ, colV, value)));
          }
        }
      }
    }
  }

  return allOf(matchers);
}
 
开发者ID:mit-ll,项目名称:PACE,代码行数:39,代码来源:Matchers.java

示例2: testDynamicClassLoaderService

import org.hamcrest.collection.IsIterableWithSize; //导入依赖的package包/类
@Test
public void testDynamicClassLoaderService() throws MalformedURLException {
    // this will check that the java service loader works on a classloader that is mutable
    RuntimeUtil.registerMavenUrlHandler();
    // given
    ExtensibleUrlClassLoader urlClassLoader = new ExtensibleUrlClassLoader(new URL[0]);
    // 2 comp installer
    assertThat(ServiceLoader.load(ComponentInstaller.class, urlClassLoader),
            IsIterableWithSize.<ComponentInstaller> iterableWithSize(2));

    // when
    urlClassLoader.addURL(new URL("mvn:org.talend.components/multiple-runtime-comp/0.18.0"));

    // then
    // 3 comp installer
    assertThat(ServiceLoader.load(ComponentInstaller.class, urlClassLoader),
            IsIterableWithSize.<ComponentInstaller> iterableWithSize(3));

}
 
开发者ID:Talend,项目名称:components,代码行数:20,代码来源:ExtensibleUrlClassLoaderTest.java

示例3: testEquivalentToIntersectionOf

import org.hamcrest.collection.IsIterableWithSize; //导入依赖的package包/类
/**
 * See https://github.com/SciCrunch/SciGraph/wiki/MappingToOWL#equivalence-axioms
 */
@Test
public void testEquivalentToIntersectionOf() {
  Node x = getNode("http://example.org/x");
  Node y = getNode("http://example.org/y");
  Node z = getNode("http://example.org/z");

  assertThat("equivalence is symmetric and holds between all members.",
      GraphUtil.getRelationships(x, y, OwlRelationships.OWL_EQUIVALENT_CLASS, false),
      is(IsIterableWithSize.<Relationship> iterableWithSize(1)));
  assertThat("equivalence is symmetric and holds between all members.",
      GraphUtil.getRelationships(x, z, OwlRelationships.OWL_EQUIVALENT_CLASS, false),
      is(IsIterableWithSize.<Relationship> iterableWithSize(1)));
  assertThat("equivalence is symmetric and holds between all members.",
      GraphUtil.getRelationships(y, z, OwlRelationships.OWL_EQUIVALENT_CLASS, false),
      is(IsIterableWithSize.<Relationship> iterableWithSize(1)));
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:20,代码来源:TestEquivalentClasses.java

示例4: transform_string_to_enum

import org.hamcrest.collection.IsIterableWithSize; //导入依赖的package包/类
@Test
public void transform_string_to_enum () {

	List<String> days = Lists.newArrayList(
			"WEDNESDAY", 
			"SUNDAY", 
			"MONDAY", 
			"TUESDAY", 
			"WEDNESDAY");
	
    Function<String, Day> valueOfFunction = Enums.valueOfFunction(Day.class);

	Iterable<Day> daysAsEnums = Iterables.transform(days, valueOfFunction);
	
	assertThat(daysAsEnums, IsIterableWithSize.<Day>iterableWithSize(5));
	assertThat(daysAsEnums, IsIterableContainingInOrder.
			<Day>contains(
					Day.WEDNESDAY, 
					Day.SUNDAY, 
					Day.MONDAY, 
					Day.TUESDAY, 
					Day.WEDNESDAY));

}
 
开发者ID:wq19880601,项目名称:java-util-examples,代码行数:25,代码来源:EnumsExample.java

示例5: transform_string_to_enum_string_converter

import org.hamcrest.collection.IsIterableWithSize; //导入依赖的package包/类
@Test
public void transform_string_to_enum_string_converter () {

	List<String> days = Lists.newArrayList(
			"WEDNESDAY", 
			"SUNDAY", 
			"MONDAY", 
			"TUESDAY", 
			"WEDNESDAY");
	
    Function<String, Day> valueOfFunction = Enums.stringConverter(Day.class);

	Iterable<Day> daysAsEnums = Iterables.transform(days, valueOfFunction);
	
	assertThat(daysAsEnums, IsIterableWithSize.<Day>iterableWithSize(5));
	assertThat(daysAsEnums, IsIterableContainingInOrder.
			<Day>contains(
					Day.WEDNESDAY, 
					Day.SUNDAY, 
					Day.MONDAY, 
					Day.TUESDAY, 
					Day.WEDNESDAY));
}
 
开发者ID:wq19880601,项目名称:java-util-examples,代码行数:24,代码来源:EnumsExample.java

示例6: testZipped

import org.hamcrest.collection.IsIterableWithSize; //导入依赖的package包/类
@Test
public void testZipped() throws Exception {
    // given

    // when
    final Iterable<Product3<String, Double, Date>> zipped = Products.zip(Collections.singleton("a"), Collections.singleton(1.0), Collections.singleton(new Date()));

    // then
    Assert.assertThat(zipped, is(IsIterableWithSize.<Product3<String, Double, Date>>iterableWithSize(1)));
}
 
开发者ID:asoem,项目名称:greyfish,代码行数:11,代码来源:ProductsTest.java

示例7: testSubclass

import org.hamcrest.collection.IsIterableWithSize; //导入依赖的package包/类
@Test
public void testSubclass() {
  Node subclass = getNode("http://example.org/subclass");
  Node superclass = getNode("http://example.org/superclass");
  assertThat("classes should be labeled as such", subclass.hasLabel(OwlLabels.OWL_CLASS) && superclass.hasLabel(OwlLabels.OWL_CLASS));
  assertThat("subclass should be a directed relationship",
      GraphUtil.getRelationships(subclass, superclass, OwlRelationships.RDFS_SUBCLASS_OF),
      is(IsIterableWithSize.<Relationship> iterableWithSize(1)));
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:10,代码来源:TestSubClassOf.java

示例8: testSubclass

import org.hamcrest.collection.IsIterableWithSize; //导入依赖的package包/类
@Test
public void testSubclass() {
  Node subp = getNode("http://example.org/subproperty");
  Node superp = getNode("http://example.org/superproperty");
  assertThat("subclass should be a directed relationship",
      GraphUtil.getRelationships(subp, superp, OwlRelationships.RDFS_SUB_PROPERTY_OF),
      is(IsIterableWithSize.<Relationship> iterableWithSize(1)));
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:9,代码来源:TestSubObjectPropertyOf.java

示例9: evidenceIsAdded

import org.hamcrest.collection.IsIterableWithSize; //导入依赖的package包/类
@Test
public void evidenceIsAdded() {
  assertThat(graph.getVertices(), IsIterableWithSize.<Vertex>iterableWithSize(5));
  assertThat(graph.getEdges(), IsIterableWithSize.<Edge>iterableWithSize(1));
  aspect.invoke(graph);
  assertThat(graph.getVertices(), IsIterableWithSize.<Vertex>iterableWithSize(6));
  assertThat(graph.getEdges(), IsIterableWithSize.<Edge>iterableWithSize(3));
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:9,代码来源:EvidenceAspectTest.java

示例10: pathsAreTranslated

import org.hamcrest.collection.IsIterableWithSize; //导入依赖的package包/类
@Test
public void pathsAreTranslated() {
  Iterable<PropertyContainer> path = newArrayList(node, relationship, otherNode);
  TinkerGraphUtil tgu = new TinkerGraphUtil(graph, curieUtil);
  tgu.addPath(path);
  assertThat(graph.getVertices(), is(IsIterableWithSize.<Vertex>iterableWithSize(2)));
  assertThat(graph.getEdges(), is(IsIterableWithSize.<Edge>iterableWithSize(1)));
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:9,代码来源:TinkerGraphUtilTest.java

示例11: testMultiTypedNeighborhood

import org.hamcrest.collection.IsIterableWithSize; //导入依赖的package包/类
@Test
public void testMultiTypedNeighborhood() {
  Graph graph = graphApi.getNeighbors(newHashSet(b), 1, 
      newHashSet(new DirectedRelationshipType(OwlRelationships.RDFS_SUBCLASS_OF, Direction.INCOMING),
          new DirectedRelationshipType(fizz, Direction.INCOMING)), absent);
  assertThat(graph.getVertices(), IsIterableWithSize.<Vertex>iterableWithSize(3));
  assertThat(graph.getEdges(), IsIterableWithSize.<Edge>iterableWithSize(2));
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:9,代码来源:GraphApiNeighborhoodTest.java

示例12: multipleAncestors_areReturned

import org.hamcrest.collection.IsIterableWithSize; //导入依赖的package包/类
@Test
public void multipleAncestors_areReturned() {
  Graph graph = graphApi.getNeighbors(newHashSet(i), 10,
      newHashSet(new DirectedRelationshipType(OwlRelationships.RDFS_SUBCLASS_OF, Direction.OUTGOING)), absent);
  assertThat(graph.getVertices(), IsIterableWithSize.<Vertex>iterableWithSize(4));
  assertThat(graph.getEdges(), IsIterableWithSize.<Edge>iterableWithSize(4));
}
 
开发者ID:SciGraph,项目名称:SciGraph,代码行数:8,代码来源:GraphApiNeighborhoodTest.java

示例13: apply

import org.hamcrest.collection.IsIterableWithSize; //导入依赖的package包/类
@Override
public Void apply(Iterable<Variant> actual) {
  assertThat(actual, CoreMatchers.hasItem(expectedSnp1));
  assertThat(actual, CoreMatchers.hasItem(expectedSnp2));
  assertThat(actual, CoreMatchers.hasItem(expectedInsert));
  assertThat(actual, IsIterableWithSize.<Variant>iterableWithSize(3));

  return null;
}
 
开发者ID:googlegenomics,项目名称:dataflow-java,代码行数:10,代码来源:JoinNonVariantSegmentsWithVariantsTest.java

示例14: present_instances

import org.hamcrest.collection.IsIterableWithSize; //导入依赖的package包/类
@Test
public void present_instances () {
	
	List<Optional<PullRequest>> pullRequests = Lists.newArrayList();
	pullRequests.add(getPullRequestUsingGuavaOptional());
	pullRequests.add(Optional.of(new PullRequest("Graham", "a->b summary",  "please merge")));
	pullRequests.add(getPullRequestUsingGuavaOptional());
	pullRequests.add(Optional.of(new PullRequest("Jesse", "c->d summary",  "check code")));
	
	Iterable<PullRequest> presentInstances = Optional.presentInstances(pullRequests);
	
	assertThat(presentInstances, IsIterableWithSize.<PullRequest>iterableWithSize(2));
}
 
开发者ID:wq19880601,项目名称:java-util-examples,代码行数:14,代码来源:OptionalExample.java

示例15: remove_null_from_list_guava_iterables

import org.hamcrest.collection.IsIterableWithSize; //导入依赖的package包/类
@Test
public void remove_null_from_list_guava_iterables () {

	List<String> strings = Lists.newArrayList(
			null, "www", null, 
			"leveluplunch", "com", null);

	Iterable<String> filterStrings = Iterables.filter(strings, 
			Predicates.notNull());
	
	assertThat(filterStrings, IsIterableWithSize.<String>iterableWithSize(3));
}
 
开发者ID:wq19880601,项目名称:java-util-examples,代码行数:13,代码来源:FilterNullFromCollection.java


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