de.dagere.kopeme.runnables.BeforeAfterMethodRunnable Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kopeme-core Show documentation
Show all versions of kopeme-core Show documentation
KoPeMe performance testing core
package de.dagere.kopeme.runnables;
import java.lang.reflect.Method;
import java.util.List;
public class BeforeAfterMethodRunnable implements KoPeMeThrowingRunnable {
private final List beforeMethods;
private final KoPeMeThrowingRunnable runnable;
private final List afterMethods;
private final Object testObject;
public BeforeAfterMethodRunnable(final List beforeMethods, final KoPeMeThrowingRunnable runnable, final List afterMethods, final Object testObject) {
this.beforeMethods = beforeMethods;
this.runnable = runnable;
this.afterMethods = afterMethods;
this.testObject = testObject;
}
@Override
public void run() throws Throwable {
for (final Method method : beforeMethods) {
method.invoke(testObject);
}
runnable.run();
for (final Method method : afterMethods) {
method.invoke(testObject);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy