com.jayway.jsonassert.impl.matcher
Class IsCollectionWithSize<E>

java.lang.Object
  extended by org.hamcrest.BaseMatcher<C>
      extended by com.jayway.jsonassert.impl.matcher.CollectionMatcher<Collection<? extends E>>
          extended by com.jayway.jsonassert.impl.matcher.IsCollectionWithSize<E>
All Implemented Interfaces:
org.hamcrest.Matcher<Collection<? extends E>>, org.hamcrest.SelfDescribing

public class IsCollectionWithSize<E>
extends CollectionMatcher<Collection<? extends E>>

Matches if collection size satisfies a nested matcher.


Constructor Summary
IsCollectionWithSize(org.hamcrest.Matcher<? super Integer> sizeMatcher)
           
 
Method Summary
 void describeTo(org.hamcrest.Description description)
           
static
<E> org.hamcrest.Matcher<? super Collection<? extends E>>
hasSize(int size)
          This is a shortcut to the frequently used hasSize(equalTo(x)).
static
<E> org.hamcrest.Matcher<? super Collection<? extends E>>
hasSize(org.hamcrest.Matcher<? super Integer> size)
          Does collection size satisfy a given matcher?
 boolean matchesSafely(Collection<? extends E> item)
           
 
Methods inherited from class com.jayway.jsonassert.impl.matcher.CollectionMatcher
matches
 
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, describeMismatch, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IsCollectionWithSize

public IsCollectionWithSize(org.hamcrest.Matcher<? super Integer> sizeMatcher)
Method Detail

matchesSafely

public boolean matchesSafely(Collection<? extends E> item)
Specified by:
matchesSafely in class CollectionMatcher<Collection<? extends E>>

describeTo

public void describeTo(org.hamcrest.Description description)

hasSize

public static <E> org.hamcrest.Matcher<? super Collection<? extends E>> hasSize(org.hamcrest.Matcher<? super Integer> size)
Does collection size satisfy a given matcher?


hasSize

public static <E> org.hamcrest.Matcher<? super Collection<? extends E>> hasSize(int size)
This is a shortcut to the frequently used hasSize(equalTo(x)). For example, assertThat(hasSize(equal_to(x))) vs. assertThat(hasSize(x))



Copyright © 2011-2012. All Rights Reserved.