org.hamcrest.collection
Class IsEmptyCollection<E>
java.lang.Object
org.hamcrest.BaseMatcher<T>
org.hamcrest.TypeSafeMatcher<java.util.Collection<? extends E>>
org.hamcrest.collection.IsEmptyCollection<E>
- All Implemented Interfaces:
- org.hamcrest.Matcher<java.util.Collection<? extends E>>, org.hamcrest.SelfDescribing
public class IsEmptyCollection<E>
- extends org.hamcrest.TypeSafeMatcher<java.util.Collection<? extends E>>
Tests if collection is empty.
Method Summary |
void |
describeMismatchSafely(java.util.Collection<? extends E> item,
org.hamcrest.Description mismatchDescription)
|
void |
describeTo(org.hamcrest.Description description)
|
static
<E> org.hamcrest.Matcher<java.util.Collection<? extends E>> |
|
empty()
Creates a matcher for Collection s matching examined collections whose isEmpty
method returns true . |
static
<E> org.hamcrest.Matcher<java.util.Collection<E>> |
|
emptyCollectionOf(java.lang.Class<E> type)
Creates a matcher for Collection s matching examined collections whose isEmpty
method returns true . |
boolean |
matchesSafely(java.util.Collection<? extends E> item)
|
Methods inherited from class org.hamcrest.TypeSafeMatcher |
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 |
IsEmptyCollection
public IsEmptyCollection()
matchesSafely
public boolean matchesSafely(java.util.Collection<? extends E> item)
- Specified by:
matchesSafely
in class org.hamcrest.TypeSafeMatcher<java.util.Collection<? extends E>>
describeMismatchSafely
public void describeMismatchSafely(java.util.Collection<? extends E> item,
org.hamcrest.Description mismatchDescription)
- Overrides:
describeMismatchSafely
in class org.hamcrest.TypeSafeMatcher<java.util.Collection<? extends E>>
describeTo
public void describeTo(org.hamcrest.Description description)
empty
public static <E> org.hamcrest.Matcher<java.util.Collection<? extends E>> empty()
- Creates a matcher for
Collection
s matching examined collections whose isEmpty
method returns true
.
For example:
assertThat(new ArrayList<String>(), is(empty()))
emptyCollectionOf
public static <E> org.hamcrest.Matcher<java.util.Collection<E>> emptyCollectionOf(java.lang.Class<E> type)
- Creates a matcher for
Collection
s matching examined collections whose isEmpty
method returns true
.
For example:
assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
- Parameters:
type
- the type of the collection's content