cleanup and added tests

This commit is contained in:
Shekhar Gulati
2016-07-19 18:13:13 +05:30
parent acdb15d6fe
commit ec7cb02800
2 changed files with 46 additions and 2 deletions
+41 -1
View File
@@ -26,6 +26,7 @@
package strman;
import org.junit.Ignore;
import org.junit.Test;
import java.util.Arrays;
@@ -800,7 +801,8 @@ public class StrmanTest {
" de_camelize"
};
Arrays.stream(fixture).forEach(el -> assertThat(String.format("toKebabCase(%s) should be de-camelize", el), toKebabCase(el), equalTo("de-camelize")));
Arrays.stream(fixture).forEach(el ->
assertThat(String.format("toKebabCase(%s) should be de-camelize", el), toKebabCase(el), equalTo("de-camelize")));
}
@Test
@@ -845,4 +847,42 @@ public class StrmanTest {
String result = removeRight("Remove the END at the end", " END", false);
assertThat(result, is("Remove the END at the"));
}
@Test
public void transliterate_shouldDeburrTheString() throws Exception {
String result = transliterate("déjà vu");
assertThat(result, is(equalTo("deja vu")));
}
@Ignore
public void htmlEncode_shouldConvertCharactersToTheirHtmlEntities() throws Exception {
String result = htmlEncode("fred, barney, & pebbles");
assertThat(result, is(equalTo("fred, barney, & pebbles")));
}
@Ignore
public void kebabCase_shouldConvertAStringToKebabCase() throws Exception {
String[] input = {
"Foo Bar",
"fooBar",
"__FOO_BAR__"
};
Arrays.stream(input).forEach(el ->
assertThat(String.format("%s should be foo-bar", el), toKebabCase(el), is(equalTo("foo-bar"))));
}
@Ignore
public void snakeCase_shouldConvertAStringToSnakecase() throws Exception {
String[] input = {
"Foo Bar",
"fooBar",
"--FOO-BAR--"
};
Arrays.stream(input).forEach(el ->
assertThat(String.format("%s should be foo_bar", el), toSnakeCase(el), is(equalTo("foo_bar"))));
}
}