Top Description Fields Constructors Methods
org.hamcrest.text

public final Class IsEmptyString

extends BaseMatcher<String>
Class Inheritance
Static Imports
org.hamcrest.core.AnyOf.anyOf, .IsNull.nullValue

Matches empty Strings (and null).

Field Summary

Modifier and TypeField and Description
private static final IsEmptyString
private static final Matcher<String>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
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 Matcher<String>
isEmptyOrNullString()

Creates a matcher of String that matches when the examined string is null, or has zero length.

public static Matcher<String>
isEmptyString()

Creates a matcher of String that matches when the examined string has zero length.

public boolean
matches(Object
the object against which the matcher is evaluated.
item
)

Implements org.hamcrest.Matcher.matches.

Evaluates the matcher for argument item.
Inherited from org.hamcrest.BaseMatcher:
_dont_implement_Matcher___instead_extend_BaseMatcher_describeMismatchtoString

Field Detail

INSTANCEback to summary
private static final IsEmptyString INSTANCE
NULL_OR_EMPTY_INSTANCEback to summary
private static final Matcher<String> NULL_OR_EMPTY_INSTANCE
Annotations
@SuppressWarnings:unchecked

Constructor Detail

IsEmptyStringback to summary
public IsEmptyString()

Method Detail

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
isEmptyOrNullStringback to summary
public static Matcher<String> isEmptyOrNullString()

Creates a matcher of String that matches when the examined string is null, or has zero length.

For example:

assertThat(((String)null), isEmptyString())
Annotations
@Factory
isEmptyStringback to summary
public static Matcher<String> isEmptyString()

Creates a matcher of String that matches when the examined string has zero length.

For example:

assertThat("", isEmptyString())
Annotations
@Factory
matchesback to summary
public boolean matches(Object item)

Implements org.hamcrest.Matcher.matches.

Doc from org.hamcrest.Matcher.matches.

Evaluates the matcher for argument item.

This method matches against Object, instead of the generic type T. This is because the caller of the Matcher does not know at runtime what the type is (because of type erasure with Java generics). It is down to the implementations to check the correct type.

Parameters
item:Object

the object against which the matcher is evaluated.

Returns:boolean

true if item matches, otherwise false.

Annotations
@Override