String (String expected) { final List<String> strings = StringUtil.split(StringUtil.trimStart(expected, "\n"), "\n"); int min = Integer.MAX_VALUE; for (String s : strings) { int k = 0; while (k < s.length() && s.charAt(k) == ' ') { k++; } min = Math.min(min, k); } List<String> lines = new ArrayList<>(); for (String s : strings) { lines.add(s.substring(min)); } return StringUtil.join(lines, "\n") + "\n"; }