mirror of
https://github.com/shekhargulati/strman-java.git
synced 2026-10-13 00:53:56 +00:00
Fixed #21. Added support for removeRight function
This commit is contained in:
@@ -513,6 +513,8 @@ public class StrmanTest {
|
||||
};
|
||||
|
||||
Arrays.stream(fixture).forEach(el -> assertThat(removeLeft(el, "foo"), equalTo("bar")));
|
||||
assertThat(removeLeft("barfoo", "foo"), equalTo("barfoo"));
|
||||
assertThat(removeLeft("foofoo", "foo"), equalTo("foo"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -536,4 +538,26 @@ public class StrmanTest {
|
||||
|
||||
Arrays.stream(fixture).forEach(el -> assertThat(removeNonWords(el), equalTo("foobar")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void removeRight_shouldRemoveStringFromRight() throws Exception {
|
||||
final String[] fixture = {
|
||||
"foobar",
|
||||
"foo"
|
||||
};
|
||||
|
||||
Arrays.stream(fixture).forEach(el -> assertThat(removeRight(el, "bar"), equalTo("foo")));
|
||||
assertThat(removeRight("barfoo", "bar"), equalTo("barfoo"));
|
||||
assertThat(removeRight("barbar", "bar"), equalTo("bar"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void removeRight_shouldRemoveStringFromRightCaseInSensitive() throws Exception {
|
||||
final String[] fixture = {
|
||||
"foobar",
|
||||
"foo"
|
||||
};
|
||||
|
||||
Arrays.stream(fixture).forEach(el -> assertThat(removeRight(el, "BAR", false), equalTo("foo")));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user