boolean shouldIntercept(Class testClass) { Listeners listenersAnnotation = getListenersAnnotation(testClass); return listenersAnnotation != null && asList(listenersAnnotation.value()).contains(SoftAsserts.class); }
@SuppressWarnings({"deprecation"}) private IAnnotation createListenersTag(Class<?> cls, Annotation a, IAnnotationTransformer transformer) { ListenersAnnotation result = new ListenersAnnotation(); Listeners l = (Listeners) a; result.setValue(l.value()); return result; }
private IAnnotation createListenersTag(Annotation a) { ListenersAnnotation result = new ListenersAnnotation(); Listeners l = (Listeners) a; result.setValue(l.value()); return result; }
private boolean checkBMNGListener(Class<?> clazz) { Listeners listeners = clazz.getAnnotation(Listeners.class); if (listeners == null) { return false; } Class<? extends ITestNGListener>[] clazzarray = listeners.value(); for (int i = 0; i < clazzarray.length; i++) { if (clazzarray[i] == BMNGListener.class) { return true; } } return false; }
private boolean hasEverrestJettyListener(Class<?> clazz) { Listeners listeners = clazz.getAnnotation(Listeners.class); if (listeners == null) { return false; } for (Class<? extends ITestNGListener> listenerClass : listeners.value()) { if (EverrestJetty.class.isAssignableFrom(listenerClass)) { return true; } } return false; }
protected boolean hasMockitoTestNGListener(Class<?> clazz) { Listeners listeners = clazz.getAnnotation(Listeners.class); if (listeners == null) { return false; } for (Class<? extends ITestNGListener> listenerClass : listeners.value()) { if (listenerClass() == listenerClass) { return true; } } return false; }
public boolean shouldIntercept(Class testClass, Class annotation) { Listeners listenersAnnotation = getListenersAnnotation(testClass); return listenersAnnotation != null && asList(listenersAnnotation.value()).contains(annotation); }
/** * Returns <code>true</code> if the specified test class or one of its superclass is annotated with * {@link Listeners} referencing at least a specified listener class, <code>false</code> otherwise. Because any * {@link Listeners} annotation will apply to the entire suite and not only to the annotated class. * * @param testClass the class being tested for the {@link Listeners} annotation. * @param listenerClasses the listener classes to look for. * @return <code>true</code> if the specified test class or one of its superclass is annotated with * {@link Listeners} referencing at least a specified listener class, <code>false</code> otherwise. */ @SuppressWarnings("unchecked") public static boolean isListening(Class<?> testClass, Class<? extends ITestNGListener>... listenerClasses) { // CSOFF: ReturnCountCheck -2 Listeners listenerAnnotation = testClass.getAnnotation(Listeners.class); if (listenerAnnotation != null) { for (Class<? extends ITestNGListener> actualListenerClass : listenerAnnotation.value()) { for (Class<? extends ITestNGListener> listenerClass : listenerClasses) { if (listenerClass.isAssignableFrom(actualListenerClass)) { return true; } } } } if (testClass.getSuperclass() != null) { return isListening(testClass.getSuperclass(), listenerClasses); } return false; }
private boolean isListenerDefinedOnTestClass(IInvokedMethod method) { Class<?> cls = method.getTestMethod().getTestClass().getRealClass(); while (cls != null) { Listeners annotation = cls.getAnnotation(Listeners.class); if (annotation != null) { for(Class<?> listener : annotation.value()) { if (this.getClass().equals(listener)) { return true; } } } cls = cls.getSuperclass(); } return false; } }
private boolean isListenerDefinedOnTestClass(IInvokedMethod method) { Class<?> cls = method.getTestMethod().getTestClass().getRealClass(); while (cls != null) { Listeners annotation = cls.getAnnotation(Listeners.class); if (annotation != null) { for(Class<?> listener : annotation.value()) { if (this.getClass().equals(listener)) { return true; } } } cls = cls.getSuperclass(); } return false; } }