### Question:
LegacyTaglibFunctions { public static String substring(@Nullable String input, int beginIndex, int endIndex) { if (input == null) { input = ""; } if (beginIndex >= input.length()) { return ""; } if (beginIndex < 0) { beginIndex = 0; } if (endIndex < 0 || endIndex > input.length()) { endIndex = input.length(); } if (endIndex < beginIndex) { return ""; } return input.substring(beginIndex, endIndex); }  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 testSubstring() { assertThat(substring(null, -1, 100)).isEqualTo(""); assertThat(substring("", -1, 100)).isEqualTo(""); assertThat(substring("foo", -1, 100)).isEqualTo("foo"); assertThat(substring("foo", 100, 4)).isEqualTo(""); assertThat(substring("foo", 0, -1)).isEqualTo("foo"); assertThat(substring("foobarbaz", 4, 2)).isEqualTo(""); assertThat(substring("foobarbaz", 3, 6)).isEqualTo("bar"); }