### Question:
LegacyTaglibFunctions { public static String replace( @Nullable String input, @Nullable String substringBefore, final String substringAfter) { if (input == null) { input = ""; } if (input.isEmpty()) { return ""; } if (substringBefore == null) { substringBefore = ""; } if (substringBefore.isEmpty()) { return input; } final StringBuilder buf = new StringBuilder(input.length()); int startIndex = 0; int index; while ((index = input.indexOf(substringBefore, startIndex)) != -1) { buf.append(input.substring(startIndex, index)).append(substringAfter); startIndex = index + substringBefore.length(); } return buf.append(input.substring(startIndex)).toString(); }  static String toUpperCase(@Nullable final String input); static String toLowerCase(@Nullable final String input); static int indexOf(@Nullable String input, @Nullable String substring); static boolean contains(@Nullable final String input, @Nullable final String substring); static boolean containsIgnoreCase(@Nullable String input, @Nullable String substring); static boolean startsWith(@Nullable String input, @Nullable String substring); static boolean endsWith(@Nullable String input, @Nullable String substring); static String substring(@Nullable String input, int beginIndex, int endIndex); static String substringAfter(@Nullable String input, @Nullable String substring); static String substringBefore(@Nullable String input, @Nullable String substring); static String trim(@Nullable final String input); static String replace(
            @Nullable String input,
            @Nullable String substringBefore,
            final String substringAfter); static String[] split(
            @Nullable String input,
            @Nullable String delimiters); static int length(@Nullable final Object obj); static String join(@Nullable final String[] array, @Nullable String separator);  }### Answer:
@Test public void testReplace() { assertThat(replace(null, null, null)).isEqualTo(""); assertThat(replace("", null, null)).isEqualTo(""); assertThat(replace("foo", null, null)).isEqualTo("foo"); assertThat(replace(null, "", null)).isEqualTo(""); assertThat(replace(null, null, "")).isEqualTo(""); assertThat(replace("", null, "")).isEqualTo(""); assertThat(replace("foo", null, "")).isEqualTo("foo"); assertThat(replace(null, "", "")).isEqualTo(""); assertThat(replace("", "", "")).isEqualTo(""); assertThat(replace("foo", "", "")).isEqualTo("foo"); assertThat(replace("", "foo", "")).isEqualTo(""); assertThat(replace("", "", "foo")).isEqualTo(""); assertThat(replace("bar", "", "foo")).isEqualTo("bar"); assertThat(replace("foo", "foo", "")).isEqualTo(""); assertThat(replace("foobarfoo", "foo", "bum")).isEqualTo("bumbarbum"); }