Top Description Fields Constructors Methods
org.hamcrest.text

public final Class IsBlankString

extends TypeSafeMatcher<String>
Class Inheritance
Imports
org.hamcrest.Description, .Matcher, .TypeSafeMatcher, java.util.regex.Pattern

Matches blank Strings (and null).

Field Summary

Modifier and TypeField and Description
private static final IsBlankString
private static final Matcher<String>
private static final Pattern

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Matcher<String>
blankOrNullString()

Creates a matcher of String that matches when the examined string is null, or contains zero or more whitespace characters and nothing else.

public static Matcher<String>
blankString()

Creates a matcher of String that matches when the examined string contains zero or more whitespace characters and nothing else.

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 boolean
matchesSafely(String item)

Implements abstract org.hamcrest.TypeSafeMatcher.matchesSafely.

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

Field Detail

BLANK_INSTANCEback to summary
private static final IsBlankString BLANK_INSTANCE
NULL_OR_BLANK_INSTANCEback to summary
private static final Matcher<String> NULL_OR_BLANK_INSTANCE
Annotations
@SuppressWarnings:unchecked
REGEX_WHITESPACEback to summary
private static final Pattern REGEX_WHITESPACE

Constructor Detail

IsBlankStringback to summary
private IsBlankString()

Method Detail

blankOrNullStringback to summary
public static Matcher<String> blankOrNullString()

Creates a matcher of String that matches when the examined string is null, or contains zero or more whitespace characters and nothing else. For example:

assertThat(((String)null), is(blankOrNullString()))
blankStringback to summary
public static Matcher<String> blankString()

Creates a matcher of String that matches when the examined string contains zero or more whitespace characters and nothing else. For example:

assertThat("  ", is(blankString()))
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
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