Fixed #18. Added support for removeEmptyStrings function

This commit is contained in:
Shekhar Gulati
2016-05-21 18:38:18 +05:30
parent 8ec7c8eae0
commit 0aa874fa93
2 changed files with 19 additions and 0 deletions
+6
View File
@@ -9,6 +9,7 @@ import static java.util.stream.Collectors.toList;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.hasItems;
import static org.hamcrest.collection.IsArrayContainingInOrder.arrayContaining;
import static org.hamcrest.collection.IsArrayWithSize.emptyArray;
import static org.junit.Assert.*;
import static strman.Strman.*;
import static strman.Strman.format;
@@ -498,4 +499,9 @@ public class StrmanTest {
assertThat(prependArray("bar", new String[]{"foo"}), equalTo("foobar"));
}
@Test
public void removeEmptyStrings_shouldRemoveEmptyStrings() throws Exception {
assertThat(removeEmptyStrings(new String[]{"aa", "", " ", "bb", "cc", null}), arrayContaining("aa", "bb", "cc"));
assertThat(removeEmptyStrings(new String[0]), emptyArray());
}
}