@Test
public void testPublicAndFinalMethods() throws Exception {

  MethodModifierMatcher publicMethodsMatcher = new MethodModifierMatcher(AccessFlag.PUBLIC);
  MethodModifierMatcher protectedMethodsMatcher = new MethodModifierMatcher(AccessFlag.FINAL);
  AndMatcher orMatcher = new AndMatcher(publicMethodsMatcher, protectedMethodsMatcher);
  CtClass ctClass = pool.get(PublicFinalModifiers.class.getCanonicalName());
  CtBehavior ctBehavior = ctClass.getDeclaredMethod("isNegative");
  assertTrue(orMatcher.matches(ctBehavior));
  ctClass = pool.get(PublicModifiers.class.getCanonicalName());
  ctBehavior = ctClass.getDeclaredMethod("isNegative");
  assertFalse(orMatcher.matches(ctBehavior));
  ctClass = pool.get(ProtectedModifiers.class.getCanonicalName());
  ctBehavior = ctClass.getDeclaredMethod("isNegative");
  assertFalse(orMatcher.matches(ctBehavior));
  ctClass = pool.get(PrivateModifiers.class.getCanonicalName());
  ctBehavior = ctClass.getDeclaredMethod("isNegative");
  assertFalse(orMatcher.matches(ctBehavior));
}