### Question:
RegexpClassNameMatcher implements ClassNameMatcher { @Override public boolean matches(String className) { return pattern.matcher(className).matches(); } RegexpClassNameMatcher(String regex);  RegexpClassNameMatcher(Pattern pattern); @Override boolean matches(String className);  }### Answer:
@Test public void testSimplePatternFromString() { ClassNameMatcher ca = new RegexpClassNameMatcher("foo.*"); assertTrue(ca.matches("foo.should.match")); assertFalse(ca.matches("bar.should.not.match")); }
@Test public void testSimplePatternFromPattern() { ClassNameMatcher ca = new RegexpClassNameMatcher(Pattern.compile("foo.*")); assertTrue(ca.matches("foo.should.match")); assertFalse(ca.matches("bar.should.not.match")); }
@Test public void testOrPattern() { ClassNameMatcher ca = new RegexpClassNameMatcher("foo.*|bar.*"); assertTrue(ca.matches("foo.should.match")); assertTrue(ca.matches("bar.should.match")); assertFalse(ca.matches("zoo.should.not.match")); }