CodeWriter { public CodeWriter setExpressionStart(char expressionStart) { if (expressionStart == ' ' || expressionStart == '\n') { throw new IllegalArgumentException("expressionStart must not be set to " + expressionStart); } currentState.expressionStart = expressionStart; return this; } CodeWriter(); static CodeWriter createDefault(); static String formatLiteral(Object value); final CodeWriter putFormatter(char identifier, BiFunction<Object, String, String> formatter); CodeWriter setExpressionStart(char expressionStart); @Override String toString(); final CodeWriter pushState(); CodeWriter pushState(String sectionName); CodeWriter popState(); CodeWriter onSection(String sectionName, Consumer<Object> interceptor); CodeWriter disableNewlines(); CodeWriter enableNewlines(); final CodeWriter setNewline(String newline); final CodeWriter setNewline(char newline); final CodeWriter setIndentText(String indentText); final CodeWriter trimTrailingSpaces(); final CodeWriter trimTrailingSpaces(boolean trimTrailingSpaces); final CodeWriter trimBlankLines(); final CodeWriter trimBlankLines(int trimBlankLines); final CodeWriter insertTrailingNewline(); final CodeWriter insertTrailingNewline(boolean trailingNewline); final CodeWriter setNewlinePrefix(String newlinePrefix); final CodeWriter indent(); final CodeWriter indent(int levels); final CodeWriter dedent(); final CodeWriter dedent(int levels); final CodeWriter openBlock(String textBeforeNewline, Object... args); final CodeWriter openBlock(String textBeforeNewline, String textAfterNewline, Runnable f); final CodeWriter openBlock(String textBeforeNewline, String textAfterNewline, Object arg1, Runnable f); final CodeWriter openBlock(String textBeforeNewline, String textAfterNewline,
            Object arg1, Object arg2, Runnable f); final CodeWriter openBlock(String textBeforeNewline, String textAfterNewline,
            Object arg1, Object arg2, Object arg3, Runnable f); final CodeWriter openBlock(String textBeforeNewline, String textAfterNewline,
            Object arg1, Object arg2, Object arg3, Object arg4, Runnable f); final CodeWriter openBlock(String textBeforeNewline, String textAfterNewline,
            Object arg1, Object arg2, Object arg3, Object arg4, Object arg5, Runnable f); final CodeWriter openBlock(String textBeforeNewline, String textAfterNewline, Object[] args, Runnable f); final CodeWriter closeBlock(String textAfterNewline, Object... args); final CodeWriter write(Object content, Object... args); final CodeWriter writeInline(Object content, Object... args); final CodeWriter writeOptional(Object content); final CodeWriter call(Runnable task); CodeWriter putContext(String key, Object value); final CodeWriter putContext(Map<String, Object> mappings); CodeWriter removeContext(String key); Object getContext(String key);  }
@Test public void expressionStartCannotBeSpace() { Assertions.assertThrows(IllegalArgumentException.class, () -> new CodeWriter().setExpressionStart(' ')); }
@Test public void expressionStartCannotBeNewline() { Assertions.assertThrows(IllegalArgumentException.class, () -> new CodeWriter().setExpressionStart('\n')); }