org.hamcrest.collection
Class IsCollectionWithSize<E>
java.lang.Object
org.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeDiagnosingMatcher<T>
org.hamcrest.FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>
org.hamcrest.collection.IsCollectionWithSize<E>
- All Implemented Interfaces:
- org.hamcrest.Matcher<java.util.Collection<? extends E>>, org.hamcrest.SelfDescribing
public class IsCollectionWithSize<E>
- extends org.hamcrest.FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>
Matches if collection size satisfies a nested matcher.
|
Constructor Summary |
IsCollectionWithSize(org.hamcrest.Matcher<? super java.lang.Integer> sizeMatcher)
|
|
Method Summary |
protected java.lang.Integer |
featureValueOf(java.util.Collection<? extends E> actual)
|
static
<E> org.hamcrest.Matcher<java.util.Collection<? extends E>> |
|
hasSize(int size)
This is a shortcut to the frequently used hasSize(equalTo(x)). |
static
<E> org.hamcrest.Matcher<java.util.Collection<? extends E>> |
|
hasSize(org.hamcrest.Matcher<? super java.lang.Integer> size)
Does collection size satisfy a given matcher? |
| Methods inherited from class org.hamcrest.FeatureMatcher |
describeTo, matchesSafely |
| Methods inherited from class org.hamcrest.TypeSafeDiagnosingMatcher |
describeMismatch, matches |
| Methods inherited from class org.hamcrest.BaseMatcher |
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
IsCollectionWithSize
public IsCollectionWithSize(org.hamcrest.Matcher<? super java.lang.Integer> sizeMatcher)
featureValueOf
protected java.lang.Integer featureValueOf(java.util.Collection<? extends E> actual)
- Specified by:
featureValueOf in class org.hamcrest.FeatureMatcher<java.util.Collection<? extends E>,java.lang.Integer>
hasSize
public static <E> org.hamcrest.Matcher<java.util.Collection<? extends E>> hasSize(org.hamcrest.Matcher<? super java.lang.Integer> size)
- Does collection size satisfy a given matcher?
hasSize
public static <E> org.hamcrest.Matcher<java.util.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 © 2010. All Rights Reserved.