org.testng.annotations.Listeners Java Examples

The following examples show how to use org.testng.annotations.Listeners. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MockitoTestNGListener.java    From mockito-cookbook with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #2
Source File: MockitoTestNGListener.java    From astor with GNU General Public License v2.0 5 votes vote down vote up
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;
}
 
Example #3
Source File: EverrestJetty.java    From everrest with Eclipse Public License 2.0 5 votes vote down vote up
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;
}
 
Example #4
Source File: TestNgListener.java    From video-recorder-java with MIT License 4 votes vote down vote up
public boolean shouldIntercept(Class testClass, Class annotation) {
    Listeners listenersAnnotation = getListenersAnnotation(testClass);
    return listenersAnnotation != null && asList(listenersAnnotation.value()).contains(annotation);
}
 
Example #5
Source File: TestNgListener.java    From video-recorder-java with MIT License 4 votes vote down vote up
private Listeners getListenersAnnotation(Class testClass) {
    Annotation annotation = testClass.getAnnotation(Listeners.class);
    return annotation != null ? (Listeners) annotation :
            testClass.getSuperclass() != null ? getListenersAnnotation(testClass.getSuperclass()) : null;
}