com.nordstrom.automation.junit.EachTestNotifierInit Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of junit-foundation Show documentation
Show all versions of junit-foundation Show documentation
This is the foundation framework for JUnit automation
package com.nordstrom.automation.junit;
import static com.nordstrom.automation.junit.LifecycleHooks.toMapKey;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import org.junit.internal.runners.model.EachTestNotifier;
import org.junit.runner.Description;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.model.FrameworkMethod;
import com.nordstrom.common.base.UncheckedThrow;
import net.bytebuddy.implementation.bind.annotation.Argument;
/**
* This class declares the interceptor for the constructor of the {@link EachTestNotifier} class.
*/
public class EachTestNotifierInit {
private static final Map DESCRIPTION_TO_ATOMICTEST = new ConcurrentHashMap<>();
private static final Map TARGET_TO_DESCRIPTION = new ConcurrentHashMap<>();
private static final Map DESCRIPTION_TO_TARGET = new ConcurrentHashMap<>();
private static final Map HASHCODE_TO_DESCRIPTION = new ConcurrentHashMap<>();
/**
* Interceptor for the constructor of the {@link EachTestNotifier} class.
*
* @param notifier {@link RunNotifier} argument
* @param description {@link Description} argument
*/
public static void interceptor(@Argument(0) final RunNotifier notifier,
@Argument(1) final Description description) {
// if notifier for test
if (AtomicTest.isTest(description)) {
// create new atomic test object
AtomicTest atomicTest = newAtomicTestFor(description);
// get current thread runner
Object runner = atomicTest.getRunner();
FrameworkMethod method = null;
// get particle methods of current runner
List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy