Fixed #21. Added support for removeRight function

This commit is contained in:
Shekhar Gulati
2016-05-21 19:22:11 +05:30
parent ba7020d594
commit 7a56392896
2 changed files with 50 additions and 1 deletions
+24
View File
@@ -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")));
}
}