### Question:
CaseTools { public static String snake(String s) { if (s == null) { return null; } int dst = 0; final var result = new char[2 * s.length()]; for (int src = 0; src < s.length(); src++) { if (Character.isUpperCase(s.charAt(src)) && src > 0) { result[dst++] = '_'; } result[dst++] = Character.toUpperCase(s.charAt(src)); } return new String(result, 0, dst); }  static String lcase(String s); static String ucase(String s); static String camel(String s); static String snake(String s);  }### Answer:
@Test @DisplayName("snake converts a normal non-empty string containing no upper case") void snakeConvertsNo_() { assertEquals("THIS_IS_TO_BE_SNAKED", snake("ThisIsToBeSnaked")); }
@Test @DisplayName("snake converts an empty string") void snakeConvertsEmpty() { assertEquals("", snake("")); }
@Test @DisplayName("snake converts a null string") void snakeConvertsNull() { assertEquals(null, snake(null)); }