com.nordstrom.automation.junit.HookInstallingPlugin 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 net.bytebuddy.matcher.ElementMatchers.*;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import net.bytebuddy.build.Plugin;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.dynamic.DynamicType.Builder;
import net.bytebuddy.implementation.MethodDelegation;
public class HookInstallingPlugin implements Plugin {
@Override
public boolean matches(TypeDescription target) {
return ! target.isAssignableTo(Hooked.class);
}
@Override
public Builder> apply(Builder> builder, TypeDescription typeDescription) {
return builder.method(isAnnotatedWith(anyOf(Test.class, Before.class, After.class))
.or(isStatic().and(isAnnotatedWith(anyOf(BeforeClass.class, AfterClass.class)))))
.intercept(MethodDelegation.to(MethodInterceptor.class))
.implement(Hooked.class);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy