Ejemplo n.º 1
0
  void testInterceptorMethods(
      Set<LifecycleCallbackDescriptor> callbackDescs,
      String callbackMethodName,
      Boolean isBeanMethod) {
    if (callbackMethodName.equals("AroundInvoke"))
      return; // this test applies only to lifecycle callback methods

    ClassLoader cl = getVerifierContext().getClassLoader();
    for (LifecycleCallbackDescriptor callbackDesc : callbackDescs) {
      try {
        Method method = callbackDesc.getLifecycleCallbackMethodObject(cl);
        Class<?>[] args = method.getParameterTypes();
        if (isBeanMethod && args.length != 0) {
          logFailure(callbackMethodName, method);
        } else if (!isBeanMethod
            && (args.length != 1
                || !javax.interceptor.InvocationContext.class.isAssignableFrom(args[0]))) {
          logFailure(callbackMethodName, method);
        }
      } catch (Exception e) {
      } // ignore as it will be caught in other tests
    }
  }