java类org.hamcrest.collection.IsIterableWithSize的实例源码

GraphApiNeighborhoodTest.java 文件源码 项目:SciGraph 阅读 20 收藏 0 点赞 0 评论 0
@Test
public void test1Neighborhood() {
  Graph graph = graphApi.getNeighbors(newHashSet(b), 1, Collections.<DirectedRelationshipType>emptySet(), absent);
  assertThat(graph.getVertices(), IsIterableWithSize.<Vertex>iterableWithSize(4));
  assertThat(graph.getEdges(), IsIterableWithSize.<Edge>iterableWithSize(3));
}
GraphApiNeighborhoodTest.java 文件源码 项目:SciGraph 阅读 24 收藏 0 点赞 0 评论 0
@Test
public void testKNeighborhood() {
  Graph graph = graphApi.getNeighbors(newHashSet(b), 10, Collections.<DirectedRelationshipType>emptySet(), absent);
  assertThat(graph.getVertices(), IsIterableWithSize.<Vertex>iterableWithSize(5));
  assertThat(graph.getEdges(), IsIterableWithSize.<Edge>iterableWithSize(4));
}
GraphApiNeighborhoodTest.java 文件源码 项目:SciGraph 阅读 28 收藏 0 点赞 0 评论 0
@Test
public void testTypedNeighborhood() {
  Graph graph = graphApi.getNeighbors(newHashSet(b), 2, newHashSet(new DirectedRelationshipType(OwlRelationships.RDFS_SUBCLASS_OF, Direction.INCOMING)), absent);
  assertThat(graph.getVertices(), IsIterableWithSize.<Vertex>iterableWithSize(3));
  assertThat(graph.getEdges(), IsIterableWithSize.<Edge>iterableWithSize(2));
}
GraphApiNeighborhoodTest.java 文件源码 项目:SciGraph 阅读 25 收藏 0 点赞 0 评论 0
@Test
public void testSingleNodeNeighborhood() {
  Graph graph = graphApi.getNeighbors(newHashSet(f), 1, Collections.<DirectedRelationshipType>emptySet(), absent);
  assertThat(graph.getVertices(), IsIterableWithSize.<Vertex>iterableWithSize(1));
  assertThat(graph.getEdges(), IsIterableWithSize.<Edge>iterableWithSize(0));
}
CypherInflectorTest.java 文件源码 项目:SciGraph 阅读 21 收藏 0 点赞 0 评论 0
@Test
public void inflectorAppliesCorrectly() {
  path.setVendorExtension("x-query", "MATCH (n) RETURN n");
  TinkerGraph graph = (TinkerGraph) inflector.apply(context).getEntity();
  assertThat(graph.getVertices(), IsIterableWithSize.<Vertex>iterableWithSize(6));
}
CypherInflectorTest.java 文件源码 项目:SciGraph 阅读 19 收藏 0 点赞 0 评论 0
@Test
public void pathsAreReturnedCorrectly() {
  path.setVendorExtension("x-query","MATCH (n {iri:'http://x.org/#foo'})-[path:subPropertyOf*]-(m) RETURN n, path, m");
  TinkerGraph graph = (TinkerGraph) inflector.apply(context).getEntity();
  assertThat(graph.getEdges(), IsIterableWithSize.<Edge>iterableWithSize(1));
}
MoxieMatchers.java 文件源码 项目:moxiemocks 阅读 26 收藏 0 点赞 0 评论 0
/**
 *
 * Matches an {@link Iterable} of the specified size.  (The size may be a {@link MoxieMatchers} invocation.)
 * <p>
 *
 * The class argument to this method is not matched against the value passed to the mocked method; it is provided
 * as a convenient way of specifying the type parameter for those who wish to statically import this method.
 * <p>
 *
 * @param iterableClass  Type of the expected iterable
 * @param size           Desired size of the iterable (raw value or {@link MoxieMatchers} invocation)
 * @return <code>null</code>
 */
@SuppressWarnings("unchecked")
static public <I extends Iterable> I iterableSize(Class<I> iterableClass, int size) {
    final Matcher<Integer> sizeMatcher = MatcherSyntax.singleMatcherFragment(Integer.TYPE, size);
    return (I) argThat(iterableClass, new IsIterableWithSize(sizeMatcher));
}


问题


面经


文章

微信
公众号

扫码关注公众号