package org.hamcrest.text;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.IsNot.not;
import static org.hamcrest.text.IsEmptyString.emptyOrNullString;
import static org.hamcrest.text.IsEmptyString.emptyString;

import org.hamcrest.AbstractMatcherTest;
import org.hamcrest.Matcher;

public class IsEmptyStringTest extends AbstractMatcherTest {

  @Override
  protected Matcher<?> createMatcher() {
    return emptyOrNullString();
  }

  public void testEmptyOrNullIsNull() {
    assertThat(null, emptyOrNullString());
  }


  public void testEmptyIsNotNull() {
    assertThat(null, not(emptyString()));
  }

  public void testMatchesEmptyString() {
    assertMatches("empty string", emptyString(), "");
    assertMatches("empty string", emptyOrNullString(), "");
  }

  public void testDoesNotMatchNonEmptyString() {
    assertDoesNotMatch("non empty string", emptyString(), "a");
  }

  public void testHasAReadableDescription() {
    assertDescription("an empty string", emptyString());
    assertDescription("(null or an empty string)", emptyOrNullString());
  }
}

@@ -52,75 +52,381 @@
 est.
-MatcherAssert.assertThat;%0Aimport static org.hamcrest.core.IsNot.not
+AbstractMatcherTest.assertDescription;%0Aimport static org.hamcrest.AbstractMatcherTest.assertDoesNotMatch;%0Aimport static org.hamcrest.AbstractMatcherTest.assertMatches;%0Aimport static org.hamcrest.AbstractMatcherTest.assertMismatchDescription;%0Aimport static org.hamcrest.AbstractMatcherTest.assertNullSafe;%0Aimport static org.hamcrest.AbstractMatcherTest.assertUnknownTypeSafe
 ;%0Aim
@@ -568,35 +568,23 @@
 amcrest.
-Abstract
 Matcher
-Test
 ;%0Aimport
@@ -588,32 +588,26 @@
 ort org.
-hamcrest.Matcher
+junit.Test
 ;%0A%0Apubli
@@ -608,16 +608,22 @@
 %0Apublic 
+final 
 class Is
@@ -642,131 +642,225 @@
 est 
-extends AbstractMatcherTest
+%7B%0A%0A    @Test public void%0A    copesWithNullsAndUnknownTypes()
  %7B%0A
-%0A
   
-@Override%0A  protected Matcher%3C?%3E createMatcher() %7B%0A    return emptyOrNullString(
+      Matcher%3CString%3E matcher = emptyOrNullString();%0A        %0A        assertNullSafe(matcher);%0A        assertUnknownTypeSafe(matcher
 );%0A  
+ 
+ 
 %7D%0A%0A  
+  @Test 
 publ
@@ -870,35 +870,46 @@
 void
- testEmptyOrNullIsNull
+%0A    matchesNullAppropriately
 () %7B%0A
+    
     
@@ -918,109 +918,111 @@
 sert
-That(null, emptyOrNullString());%0A  %7D%0A%0A%0A  public void testEmptyIsNotNull() %7B%0A    assertThat(null, not(
+Matches(%22didn't match%22, emptyOrNullString(), null);%0A        assertDoesNotMatch(%22matched unexpectedly%22, 
 empt
@@ -1034,19 +1034,34 @@
 ng()
-)
+, null
 );%0A  
+ 
+ 
 %7D%0A%0A  
+  @Test 
 publ
@@ -1071,14 +1071,14 @@
 void
- testM
+%0A    m
 atch
@@ -1087,32 +1087,36 @@
 EmptyString() %7B%0A
+    
     assertMatche
@@ -1118,36 +1118,36 @@
 atches(%22
-empty string
+didn't match
 %22, empty
 String()
@@ -1130,32 +1130,38 @@
 't match%22, empty
+OrNull
 String(), %22%22);%0A 
@@ -1159,24 +1159,28 @@
 ), %22%22);%0A    
+   
+ 
 assertMatche
@@ -1182,36 +1182,36 @@
 atches(%22
-empty string
+didn't match
 %22, empty
 OrNullSt
@@ -1194,38 +1194,32 @@
 't match%22, empty
-OrNull
 String(), %22%22);%0A 
@@ -1213,31 +1213,41 @@
 ing(), %22%22);%0A
+  
   %7D%0A%0A  
+  @Test 
 public void 
@@ -1249,44 +1249,124 @@
 void
- testDoesNotMatchNonEmptyString() %7B%0A
+%0A    doesNotmatchFilledString() %7B%0A        assertDoesNotMatch(%22matched unexpectedly%22, emptyOrNullString(), %22a%22);%0A    
     
@@ -1389,24 +1389,28 @@
 ch(%22
-non empty string
+matched unexpectedly
 %22, e
@@ -1429,23 +1429,33 @@
 , %22a%22);%0A
+  
   %7D%0A%0A  
+  @Test 
 public v
@@ -1461,41 +1461,37 @@
 void
- testHasAReadableDescription
+%0A    describesItself
 () %7B%0A
+    
     
@@ -1543,16 +1543,20 @@
 ing());%0A
+    
     asse
@@ -1620,14 +1620,214 @@
 ing());%0A
+    %7D%0A%0A    @Test public void%0A    describesAMismatch() %7B%0A        assertMismatchDescription(%22was %5C%22a%5C%22%22, emptyString(), %22a%22);%0A        assertMismatchDescription(%22was %5C%22a%5C%22%22, emptyOrNullString(), %22a%22);%0A  
   %7D%0A%7D%0A

Convert test to JUnit4 (and add mismatch description tests) in preparation for enhancement.