Top Description Fields Constructors Methods
org.hamcrest.text

public final Class IsEmptyString

extends TypeSafeMatcher<String>
Class Inheritance
Imports
org.hamcrest.Description, .Matcher, .TypeSafeMatcher

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
private

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>
emptyOrNullString()

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

public static Matcher<String>
emptyString()

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

public static Matcher<String>
isEmptyOrNullString()

Deprecated use is(emptyOrNullString()) instead
Creates a matcher of String that matches when the examined string is null, or has zero length.
public static Matcher<String>
isEmptyString()

Deprecated use is(emptyString()) instead
Creates a matcher of String that matches when the examined string has zero length.
public boolean
matchesSafely(String item)

Implements abstract org.hamcrest.TypeSafeMatcher.matchesSafely.

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

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
private 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
emptyOrNullStringback to summary
public static Matcher<String> emptyOrNullString()

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

assertThat(((String)null), is(emptyOrNullString()))
emptyStringback to summary
public static Matcher<String> emptyString()

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

assertThat("", is(emptyString()))
isEmptyOrNullStringback to summary
public static Matcher<String> isEmptyOrNullString()

Deprecated

use is(emptyOrNullString()) instead

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

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

Deprecated

use is(emptyString()) instead

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

assertThat("", isEmptyString())
Annotations
@Deprecated
matchesSafelyback to summary
public boolean matchesSafely(String 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