org.hamcrest.text
Class IsBlankString

java.lang.Object
  extended by org.hamcrest.BaseMatcher<T>
      extended by org.hamcrest.TypeSafeMatcher<String>
          extended by org.hamcrest.text.IsBlankString
All Implemented Interfaces:
Matcher<String>, SelfDescribing

public final class IsBlankString
extends TypeSafeMatcher<String>

Matches blank Strings (and null).


Method Summary
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.
static Matcher<String> blankString()
          Creates a matcher of String that matches when the examined string contains zero or more whitespace characters and nothing else.
 void describeTo(Description description)
           
 boolean matchesSafely(String item)
           
 
Methods inherited from class org.hamcrest.TypeSafeMatcher
describeMismatch, describeMismatchSafely, matches
 
Methods inherited from class org.hamcrest.BaseMatcher
_dont_implement_Matcher___instead_extend_BaseMatcher_, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

matchesSafely

public boolean matchesSafely(String item)
Specified by:
matchesSafely in class TypeSafeMatcher<String>

describeTo

public void describeTo(Description description)

blankString

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


blankOrNullString

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



Copyright © 2014. All rights reserved.