PatternUtils { public static boolean isExactMatch(String expression) { return expression != null && expression.startsWith("^") && expression.endsWith("$"); }  static boolean isExactMatch(String expression); static boolean isContainsMatch(String expression); static boolean isRegex(String expression); static String removeFirstAndLastChars(String expression);  }
@Test public void testIsExactMatch() { assertThat(isExactMatch("^something$"), is(true)); assertThat(isExactMatch("anything"), is(false)); }