88import static org .hamcrest .AbstractMatcherTest .assertUnknownTypeSafe ;
99import static org .hamcrest .text .IsEmptyString .emptyOrNullString ;
1010import static org .hamcrest .text .IsEmptyString .emptyString ;
11+ import static org .hamcrest .text .IsEmptyString .blankString ;
1112
1213import org .hamcrest .Matcher ;
1314import org .junit .Test ;
@@ -22,33 +23,45 @@ public final class IsEmptyStringTest {
2223 assertUnknownTypeSafe (matcher );
2324 }
2425
26+ @ Test public void
27+ matchesEmptyString () {
28+ assertMatches ("didn't match" , emptyOrNullString (), "" );
29+ assertMatches ("didn't match" , emptyString (), "" );
30+ assertMatches ("didn't match" , blankString (), "" );
31+ }
32+
2533 @ Test public void
2634 matchesNullAppropriately () {
2735 assertMatches ("didn't match" , emptyOrNullString (), null );
2836 assertDoesNotMatch ("matched unexpectedly" , emptyString (), null );
37+ assertDoesNotMatch ("matched unexpectedly" , blankString (), null );
2938 }
3039
3140 @ Test public void
32- matchesEmptyString () {
33- assertMatches ("didn't match" , emptyOrNullString (), "" );
34- assertMatches ("didn't match" , emptyString (), "" );
41+ matchesBlankStringAppropriately () {
42+ assertMatches ("didn't match" , blankString (), " " );
43+ assertDoesNotMatch ("matched unexpectedly" , emptyString (), " " );
44+ assertDoesNotMatch ("matched unexpectedly" , emptyOrNullString (), " " );
3545 }
3646
3747 @ Test public void
3848 doesNotmatchFilledString () {
39- assertDoesNotMatch ("matched unexpectedly" , emptyOrNullString (), "a" );
4049 assertDoesNotMatch ("matched unexpectedly" , emptyString (), "a" );
50+ assertDoesNotMatch ("matched unexpectedly" , blankString (), "a" );
51+ assertDoesNotMatch ("matched unexpectedly" , emptyOrNullString (), "a" );
4152 }
4253
4354 @ Test public void
4455 describesItself () {
4556 assertDescription ("an empty string" , emptyString ());
57+ assertDescription ("a blank string" , blankString ());
4658 assertDescription ("(null or an empty string)" , emptyOrNullString ());
4759 }
4860
4961 @ Test public void
5062 describesAMismatch () {
5163 assertMismatchDescription ("was \" a\" " , emptyString (), "a" );
64+ assertMismatchDescription ("was \" a\" " , blankString (), "a" );
5265 assertMismatchDescription ("was \" a\" " , emptyOrNullString (), "a" );
5366 }
5467}
0 commit comments