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