Added support for ensureLeft and its variants

This commit is contained in:
Shekhar Gulati
2016-05-09 15:32:37 +05:30
parent 217ebf9361
commit 47e20b35eb
2 changed files with 45 additions and 0 deletions
+17
View File
@@ -230,4 +230,21 @@ public class StrmanTest {
Arrays.stream(fixture).forEach(el -> assertTrue(endsWith(el, "BAR", el.length() - 1, false)));
}
@Test
public void ensureLeft_shouldEnsureValueStartsWithFoo() throws Exception {
String[] fixture = {
"foobar",
"bar"
};
Arrays.stream(fixture).forEach(el -> assertThat(ensureLeft(el, "foo"), equalTo("foobar")));
}
@Test
public void ensureLeft_notCaseSensitive_shouldEnsureValueStartsWithFoo() throws Exception {
assertThat(ensureLeft("foobar", "FOO", false), equalTo("foobar"));
assertThat(ensureLeft("bar", "FOO", false), equalTo("FOObar"));
}
}