### Question:
StringUtils { public static String replace(final String text, final String searchString, final String replacement) { return replace(text, searchString, replacement, -1); } private  StringUtils(); static int length(final CharSequence cs); static String repeat(final String str, final int repeat); static String repeat(final String str, final String separator, final int repeat); static String removeEnd(final String str, final String remove); static String repeat(final char ch, final int repeat); static String stripEnd(final String str, final String stripChars); static String replace(final String text, final String searchString, final String replacement); static String replace(final String text, final String searchString, final String replacement, int max); static boolean isBlank(String str); static boolean isEmpty(String str); static boolean isNoneEmpty(final String... ss); static boolean isAnyEmpty(final String... ss); static boolean isNotEmpty(String str); static boolean isEquals(String s1, String s2); static boolean isInteger(String str); static int parseInteger(String str); static boolean isJavaIdentifier(String s); static boolean isContains(String values, String value); static boolean isContains(String[] values, String value); static boolean isNumeric(String str); static String toString(Throwable e); static String toString(String msg, Throwable e); static String translate(String src, String from, String to); static String[] split(String str, char ch); static String join(String[] array); static String join(String[] array, char split); static String join(String[] array, String split); static String join(Collection<String> coll, String split); static String getQueryStringValue(String qs, String key); static Map<String, String> parseQueryString(String qs); static String getServiceKey(Map<String, String> ps); static String toQueryString(Map<String, String> ps); static String camelToSplitName(String camelName, String split); static String toArgumentString(Object[] args); static final String EMPTY; static final int INDEX_NOT_FOUND; static final String[] EMPTY_STRING_ARRAY; }### Answer:
@Test public void testReplace() throws Exception { assertThat(StringUtils.replace(null, "*", "*"), nullValue()); assertThat(StringUtils.replace("", "*", "*"), equalTo("")); assertThat(StringUtils.replace("any", null, "*"), equalTo("any")); assertThat(StringUtils.replace("any", "*", null), equalTo("any")); assertThat(StringUtils.replace("any", "", "*"), equalTo("any")); assertThat(StringUtils.replace("aba", "a", null), equalTo("aba")); assertThat(StringUtils.replace("aba", "a", ""), equalTo("b")); assertThat(StringUtils.replace("aba", "a", "z"), equalTo("zbz")); assertThat(StringUtils.replace(null, "*", "*", 64), nullValue()); assertThat(StringUtils.replace("", "*", "*", 64), equalTo("")); assertThat(StringUtils.replace("any", null, "*", 64), equalTo("any")); assertThat(StringUtils.replace("any", "*", null, 64), equalTo("any")); assertThat(StringUtils.replace("any", "", "*", 64), equalTo("any")); assertThat(StringUtils.replace("any", "*", "*", 0), equalTo("any")); assertThat(StringUtils.replace("abaa", "a", null, -1), equalTo("abaa")); assertThat(StringUtils.replace("abaa", "a", "", -1), equalTo("b")); assertThat(StringUtils.replace("abaa", "a", "z", 0), equalTo("abaa")); assertThat(StringUtils.replace("abaa", "a", "z", 1), equalTo("zbaa")); assertThat(StringUtils.replace("abaa", "a", "z", 2), equalTo("zbza")); }