@Test public void requiresTextAfterOpeningBrace() { Assertions.assertThrows(IllegalArgumentException.class, () -> { CodeFormatter formatter = new CodeFormatter(); formatter.format('$', "hello ${", "", createWriter(), "there"); }); }
String format(char expressionStart, Object content, String indent, CodeWriter writer, Object... args) { String expression = String.valueOf(content); if (args.length == 0 && expression.indexOf(expressionStart) == -1) { return expression; } return parse(expressionStart, new State(content, indent, writer, args)); }
CodeFormatter { String format(char expressionStart, Object content, String indent, CodeWriter writer, Object... args) { String expression = String.valueOf(content); if (args.length == 0 && expression.indexOf(expressionStart) == -1) { return expression; } return parse(expressionStart, new State(content, indent, writer, args)); } }
CodeFormatter { String format(char expressionStart, Object content, String indent, CodeWriter writer, Object... args) { String expression = String.valueOf(content); if (args.length == 0 && expression.indexOf(expressionStart) == -1) { return expression; } return parse(expressionStart, new State(content, indent, writer, args)); }  }
CodeFormatter { String format(char expressionStart, Object content, String indent, CodeWriter writer, Object... args) { String expression = String.valueOf(content); if (args.length == 0 && expression.indexOf(expressionStart) == -1) { return expression; } return parse(expressionStart, new State(content, indent, writer, args)); }   }
CodeFormatter { String format(char expressionStart, Object content, String indent, CodeWriter writer, Object... args) { String expression = String.valueOf(content); if (args.length == 0 && expression.indexOf(expressionStart) == -1) { return expression; } return parse(expressionStart, new State(content, indent, writer, args)); }    }