@Test public void launderLogMap() { HashMap<String, String[]> testMap = new HashMap<>(); testMap.put("a", null); testMap.put("b", new String[]{TEST_CONTENT}); testMap.put(TEST_CONTENT, new String[]{"c", "d"}); testMap.put("e\rf", new String[]{"c", "d"}); testMap.put("e<CR>f", new String[]{"g", "h"}); testMap.put("\fi\n", null); testMap.put("<FF>i\n", new String[]{"j"}); testMap.put("<FF>i<LF>", new String[]{"k"}); testMap.put("l\t\r", null); testMap.put("l<TAB>\r", null); testMap.put("l\t<CR>", null); Map<String, String[]> laundry = Laundromat.launderLog(testMap); HashMap<String, String[]> expected = new HashMap<>(); expected.put("a", null); expected.put("b", new String[]{TEST_CONTENT_LOG_LAUNDRY}); expected.put(TEST_CONTENT_LOG_LAUNDRY, new String[]{"c", "d"}); expected.put("e<CR>f", new String[]{"g", "h", "c", "d"}); expected.put("<FF>i<LF>", new String[]{"k", "j"}); expected.put("l<TAB><CR>", null); assertEquals("maps″ should be equal", hashedValues(expected), hashedValues(laundry)); }
public static String launderLog(String value) { if (value == null) { return null; } return value.replaceAll("\\n", "<LF>"). replaceAll("\\r", "<CR>"). replaceAll("\\t", "<TAB>"). replaceAll("\\f", "<FF>"); }
Laundromat { public static String launderLog(String value) { if (value == null) { return null; } return value.replaceAll("\\n", "<LF>"). replaceAll("\\r", "<CR>"). replaceAll("\\t", "<TAB>"). replaceAll("\\f", "<FF>"); } }
Laundromat { public static String launderLog(String value) { if (value == null) { return null; } return value.replaceAll("\\n", "<LF>"). replaceAll("\\r", "<CR>"). replaceAll("\\t", "<TAB>"). replaceAll("\\f", "<FF>"); } private  Laundromat(); }
Laundromat { public static String launderLog(String value) { if (value == null) { return null; } return value.replaceAll("\\n", "<LF>"). replaceAll("\\r", "<CR>"). replaceAll("\\t", "<TAB>"). replaceAll("\\f", "<FF>"); } private  Laundromat(); static String launderInput(String value); static String launderQuery(String value); static String launderLog(String value); static Map<String, String[]> launderLog(Map<String, String[]> map); }
Laundromat { public static String launderLog(String value) { if (value == null) { return null; } return value.replaceAll("\\n", "<LF>"). replaceAll("\\r", "<CR>"). replaceAll("\\t", "<TAB>"). replaceAll("\\f", "<FF>"); } private  Laundromat(); static String launderInput(String value); static String launderQuery(String value); static String launderLog(String value); static Map<String, String[]> launderLog(Map<String, String[]> map);  }