/** * Get descriptor for method (if any). * * @param cls Class. * @param mthd Method. * @return Descriptor or {@code null}. */ @Nullable public static IgnoreDescriptor forMethod(Class cls, Method mthd) { if (mthd.isAnnotationPresent(IgniteIgnore.class)) { IgniteIgnore ignore = mthd.getAnnotation(IgniteIgnore.class); String reason = ignore.value(); if (F.isEmpty(reason)) throw new IllegalArgumentException( "Reason is not set for ignored test [class=" + cls.getName() + ", method=" + mthd.getName() + ']'); return new IgnoreDescriptor(reason, ignore.forceFailure()); } else return null; }
/** * Get descriptor for class (if any). * * @param cls Class. * @return Descriptor or {@code null}. */ @Nullable public static IgnoreDescriptor forClass(Class cls) { Class cls0 = cls; while (Test.class.isAssignableFrom(cls0)) { if (cls0.isAnnotationPresent(IgniteIgnore.class)) { IgniteIgnore ignore = (IgniteIgnore) cls0.getAnnotation(IgniteIgnore.class); String reason = ignore.value(); if (F.isEmpty(reason)) throw new IllegalArgumentException( "Reason is not set for ignored test [class=" + cls0.getName() + ']'); return new IgnoreDescriptor(reason, ignore.forceFailure()); } cls0 = cls0.getSuperclass(); } return null; }