### Question:
Token { public static String escapeString(String input) { StringBuilder escaped = new StringBuilder(input.length() + 10); escaped.append('"'); for (int i = 0; i < input.length(); i++) { if (input.charAt(i) == '"') { escaped.append("\\\""); } else if (input.charAt(i) == '\\') { escaped.append("\\\\"); } else { escaped.append(input.charAt(i)); } } escaped.append('"'); return escaped.toString(); } Token(int index, String string); final int getIndex(); final String getString(); @Override String toString(); @Override boolean equals(Object obj); @Override int hashCode(); static List<Token> tokenize(final String input); static boolean isCustomizedParamOrder(List<Token> tokens); static String escapeString(String input);  }### Answer:
@Test public void testEscapeString() { String[] cases = { "aSingleToken", "a b c", "an's g'ri # quotation test", "Shell instance = new Shell(new ShellTest(), System.out", "dir \"E:\\ASG\\!dynamic\\projects\" \t-l 3492.9 ", "param1 \"par\\\"am2\"", "param1 'par\\'am2'", "\\\"param", "'param", "'", "\"", "\\'", "\\\"" }; for (int i = 0; i < cases.length; i++) { String escaped = Token.escapeString(cases[i]); List<Token> result = Token.tokenize(escaped); assertEquals(1, result.size()); assertEquals(cases[i], result.get(0).getString()); } }