Top Description Constructors Methods
org.hamcrest.collection

public Class IsEmptyCollection<E>

extends TypeSafeMatcher<Collection<? extends E>>
Class Inheritance
Imports
java.util.Collection, org.hamcrest.Description, .Factory, .Matcher, .TypeSafeMatcher

Tests if collection is empty.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
describeMismatchSafely(Collection<? extends E> item, Description mismatchDescription)

Overrides org.hamcrest.TypeSafeMatcher.describeMismatchSafely.

Subclasses should override this.
public void
describeTo(Description
The description to be built or appended to.
description
)

Implements org.hamcrest.SelfDescribing.describeTo.

Generates a description of the object.
public static <E> Matcher<Collection<? extends E>>
empty()

Creates a matcher for java.util.Collections matching examined collections whose isEmpty method returns true.

public static <E> Matcher<Collection<E>>
emptyCollectionOf(Class<E>
the type of the collection's content
type
)

Creates a matcher for java.util.Collections matching examined collections whose isEmpty method returns true.

public boolean
matchesSafely(Collection<? extends E> item)

Implements abstract org.hamcrest.TypeSafeMatcher.matchesSafely.

Subclasses should implement this.
Inherited from org.hamcrest.TypeSafeMatcher:
describeMismatchmatches

Constructor Detail

IsEmptyCollectionback to summary
public IsEmptyCollection()

Method Detail

describeMismatchSafelyback to summary
public void describeMismatchSafely(Collection<? extends E> item, Description mismatchDescription)

Overrides org.hamcrest.TypeSafeMatcher.describeMismatchSafely.

Doc from org.hamcrest.TypeSafeMatcher.describeMismatchSafely.

Subclasses should override this. The item will already have been checked for the specific type and will never be null.

Annotations
@Override
describeToback to summary
public void describeTo(Description description)

Implements org.hamcrest.SelfDescribing.describeTo.

Doc from org.hamcrest.SelfDescribing.describeTo.

Generates a description of the object. The description may be part of a a description of a larger object of which this is just a component, so it should be worded appropriately.

Parameters
description:Description

The description to be built or appended to.

Annotations
@Override
emptyback to summary
public static <E> Matcher<Collection<? extends E>> empty()

Creates a matcher for java.util.Collections matching examined collections whose isEmpty method returns true.

For example:

assertThat(new ArrayList<String>(), is(empty()))
Annotations
@Factory
emptyCollectionOfback to summary
public static <E> Matcher<Collection<E>> emptyCollectionOf(Class<E> type)

Creates a matcher for java.util.Collections matching examined collections whose isEmpty method returns true.

For example:

assertThat(new ArrayList<String>(), is(emptyCollectionOf(String.class)))
Parameters
type:Class<E>

the type of the collection's content

Annotations
@Factory
matchesSafelyback to summary
public boolean matchesSafely(Collection<? extends E> item)

Implements abstract org.hamcrest.TypeSafeMatcher.matchesSafely.

Doc from org.hamcrest.TypeSafeMatcher.matchesSafely.

Subclasses should implement this. The item will already have been checked for the specific type and will never be null.

Annotations
@Override