@Test public void testIndent_1Level_MultiLine() { String expected = "\tmulti\n\tline\n\tstring"; String input = "multi\nline\nstring"; String actual = it.indent(input); assertEquals(expected, actual); }
String indent(String s) { if (count > 0) { StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append(getIndentation()); StringBuilder r = new StringBuilder(); r.append(getIndentation()); r.append(s.replaceAll("\n", sb.toString())); return r.toString(); } else { return s; } }
IndentTracker { String indent(String s) { if (count > 0) { StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append(getIndentation()); StringBuilder r = new StringBuilder(); r.append(getIndentation()); r.append(s.replaceAll("\n", sb.toString())); return r.toString(); } else { return s; } } }
IndentTracker { String indent(String s) { if (count > 0) { StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append(getIndentation()); StringBuilder r = new StringBuilder(); r.append(getIndentation()); r.append(s.replaceAll("\n", sb.toString())); return r.toString(); } else { return s; } } IndentTracker(); }
IndentTracker { String indent(String s) { if (count > 0) { StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append(getIndentation()); StringBuilder r = new StringBuilder(); r.append(getIndentation()); r.append(s.replaceAll("\n", sb.toString())); return r.toString(); } else { return s; } } IndentTracker();  }
IndentTracker { String indent(String s) { if (count > 0) { StringBuilder sb = new StringBuilder(); sb.append("\n"); sb.append(getIndentation()); StringBuilder r = new StringBuilder(); r.append(getIndentation()); r.append(s.replaceAll("\n", sb.toString())); return r.toString(); } else { return s; } } IndentTracker();   }