### Question:
Utils { public static String toStringLiteral(String str) { if (str == null) return "null"; if (str.isEmpty()) return "\"\""; val matcher = pattern.matcher(str); val buffer = new StringBuffer(); while (matcher.find()) { val original = matcher.group(); if(original.length() == 0) continue; val replacement = findReplacement(original); matcher.appendReplacement(buffer, replacement); } matcher.appendTail(buffer); return "\"" + buffer.toString() + "\""; }  static String templateRange(int fromInclusive, int toExclusive, String delimiter); static String toTitleCase(String str); static String toCamelCase(String str); static String switchClassName(String targetName, List<Case> choices); static String switchClassName(String targetName, List<Case> choices, int skip); static String toListCode(List<D> list, Function<D, String> toCode); static String toStringLiteral(String str);  }### Answer:
@Test public void testStringLiteral() { assertEquals("\"-\\n-\\r-\\'-\\\"-\\\\\"-\"", toStringLiteral("-\n-\r-\'-\"-\\\"-")); }