Java 类org.junit.jupiter.api.Nested 实例源码

项目:webtester2-core    文件:ManagedBrowserExtension.java   
private CreateBrowsersUsing getClassLevelAnnotation(Field field) {
    Class<?> testClass = field.getDeclaringClass();
    CreateBrowsersUsing isPresent = testClass.getAnnotation(CreateBrowsersUsing.class);
    if (isPresent == null && testClass.isAnnotationPresent(Nested.class)) {
        Class<?> declaringClass = testClass.getDeclaringClass();
        while (declaringClass != null && isPresent == null) {
            isPresent = declaringClass.getAnnotation(CreateBrowsersUsing.class);
            declaringClass = declaringClass.getDeclaringClass();
        }
    }
    return isPresent;
}