All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.dagere.kopeme.runnables.BeforeAfterMethodRunnable Maven / Gradle / Ivy

There is a newer version: 1.4.0
Show newest version
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