@Test
void testTrailingWhitespaceTrimRegex() {

attern pattern = syntax.getRegexTrailingWhitespaceTrim();
  
*
 matching from start of string, zero of more space characters, followed by a dash,
 followed by one of the following: "}}", "%}", or "#}"
*/
  String expectedPatternString = "^\\s*\\Q-\\E(\\Q}}\\E|\\Q%}\\E|\\Q#}\\E)";
  // verify that the TrailingWhitepaceTrim regex in the Syntax class is the expected pattern string
  assertThat(pattern.toString()).isEqualTo(expectedPatternString);
  
  StringBuilder templateText = null;
  Matcher whitespaceTrimMatcher = null;
  
  // Whitespace Trim character with Execution Close Delimiter should match
  templateText = new StringBuilder().append("-%}");
  whitespaceTrimMatcher = pattern.matcher(templateText);
  assertThat(whitespaceTrimMatcher.lookingAt()).isEqualTo(true);
  
  // Whitespace Trim character with Print Close Delimiter should match
  templateText = new StringBuilder().append("-}}");
  whitespaceTrimMatcher = pattern.matcher(templateText);
  assertThat(whitespaceTrimMatcher.lookingAt()).isEqualTo(true);
  
  // leading space characters with Whitespace Trim character with Execution Close Delimiter should match
  templateText = new StringBuilder().append("     -%}");
  whitespaceTrimMatcher = pattern.matcher(templateText);
  assertThat(whitespaceTrimMatcher.lookingAt()).isEqualTo(true);
  
  // Whitespace Trim character with Comment Close Delimiter should match
  templateText = new StringBuilder().append("-#}");
  whitespaceTrimMatcher = pattern.matcher(templateText);
  assertThat(whitespaceTrimMatcher.lookingAt()).isEqualTo(true); 
  
  // End of expression without Whitespace Trim character should not match
  templateText = new StringBuilder().append("%}");
  whitespaceTrimMatcher = pattern.matcher(templateText);
  assertThat(whitespaceTrimMatcher.lookingAt()).isEqualTo(false);
  
  // Leading non space characters should not match
  templateText = new StringBuilder().append("abcd   -%}");
  whitespaceTrimMatcher = pattern.matcher(templateText);
  assertThat(whitespaceTrimMatcher.lookingAt()).isEqualTo(false); 
}