org.junit.jupiter.api.Nested Java Examples
The following examples show how to use
org.junit.jupiter.api.Nested.
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: DockerDriverHandler.java From selenium-jupiter with Apache License 2.0 | 6 votes |
private int getDockerBrowserCount() { int count = 0; if (context != null) { Optional<Class<?>> testClass = context.getTestClass(); if (testClass.isPresent()) { Class<?> tClass = testClass.get(); count = getCountForClass(count, tClass); while (tClass.isAnnotationPresent(Nested.class)) { try { String tClassName = tClass.getName(); String parentClass = tClassName.substring(0, tClassName.lastIndexOf('$')); log.trace("{} is Nested, adding count from parent class {}", tClassName, parentClass); tClass = tClass.getClassLoader().loadClass(parentClass); count += getCountForClass(count, tClass); } catch (ClassNotFoundException e) { log.trace("Error while loading parent class", e); } } } } else { // Interactive mode count = 1; } log.trace("Number of required Docker browser(s): {}", count); return count; }
Example #2
Source File: ManagedBrowserExtension.java From webtester2-core with Apache License 2.0 | 5 votes |
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; }