mirror of
https://github.com/shekhargulati/strman-java.git
synced 2026-10-08 13:13:54 +00:00
Added support for ensureLeft and its variants
This commit is contained in:
@@ -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"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user