PatternMatch { public boolean matches(String value) { return compliedPattern.matcher(value).matches(); } PatternMatch(String pattern); boolean matches(String value);  }
@Test public void testMatches() { assertThat(new PatternMatch("/").matches("/aaa/"), is(false)); assertThat(new PatternMatch("aaa").matches("b"), is(false)); assertThat(new PatternMatch("aaa").matches("aaa"), is(true)); assertThat(new PatternMatch("a*c").matches("abc"), is(true)); assertThat(new PatternMatch("a*c").matches("abcd"), is(false)); assertThat(new PatternMatch("*a*c").matches("xxabc"), is(true)); assertThat(new PatternMatch("a*c*").matches("abcxxx"), is(true)); assertThat(new PatternMatch("a*c*").matches("xxabcxx"), is(false)); }