Syntax { Pattern getRegexTrailingWhitespaceTrim() { return regexTrailingWhitespaceTrim; } Syntax(final String delimiterCommentOpen, final String delimiterCommentClose,
      final String delimiterExecuteOpen, final String delimiterExecuteClose,
      final String delimiterPrintOpen,
      final String delimiterPrintClose, final String delimiterInterpolationOpen,
      final String delimiterInterpolationClose, final String whitespaceTrim,
      final boolean enableNewLineTrimming); String getCommentOpenDelimiter(); String getCommentCloseDelimiter(); String getExecuteOpenDelimiter(); String getExecuteCloseDelimiter(); String getPrintOpenDelimiter(); String getPrintCloseDelimiter(); String getInterpolationOpenDelimiter(); String getInterpolationCloseDelimiter(); String getWhitespaceTrim();  }
@Test void testTrailingWhitespaceTrimRegex() { Pattern pattern = syntax.getRegexTrailingWhitespaceTrim(); String expectedPatternString = "^\\s*\\Q-\\E(\\Q}}\\E|\\Q%}\\E|\\Q#}\\E)"; assertThat(pattern.toString()).isEqualTo(expectedPatternString); StringBuilder templateText = null; Matcher whitespaceTrimMatcher = null; templateText = new StringBuilder().append("-%}"); whitespaceTrimMatcher = pattern.matcher(templateText); assertThat(whitespaceTrimMatcher.lookingAt()).isEqualTo(true); templateText = new StringBuilder().append("-}}"); whitespaceTrimMatcher = pattern.matcher(templateText); assertThat(whitespaceTrimMatcher.lookingAt()).isEqualTo(true); templateText = new StringBuilder().append(" -%}"); whitespaceTrimMatcher = pattern.matcher(templateText); assertThat(whitespaceTrimMatcher.lookingAt()).isEqualTo(true); templateText = new StringBuilder().append("-#}"); whitespaceTrimMatcher = pattern.matcher(templateText); assertThat(whitespaceTrimMatcher.lookingAt()).isEqualTo(true); templateText = new StringBuilder().append("%}"); whitespaceTrimMatcher = pattern.matcher(templateText); assertThat(whitespaceTrimMatcher.lookingAt()).isEqualTo(false); templateText = new StringBuilder().append("abcd -%}"); whitespaceTrimMatcher = pattern.matcher(templateText); assertThat(whitespaceTrimMatcher.lookingAt()).isEqualTo(false); }