Home | History | Annotate | Download | only in internal
      1 package junitparams.internal;
      2 
      3 import java.lang.reflect.Method;
      4 
      5 import org.junit.Ignore;
      6 import org.junit.runner.Description;
      7 import org.junit.runner.notification.RunNotifier;
      8 import org.junit.runners.model.FrameworkMethod;
      9 import org.junit.runners.model.Statement;
     10 
     11 /**
     12  * A {@link FrameworkMethod} that represents an unparameterized method.
     13  */
     14 public class NonParameterisedFrameworkMethod
     15         extends InvokableFrameworkMethod {
     16 
     17     private final boolean ignored;
     18 
     19     /**
     20      * Create a non-parameterised method.
     21      *
     22      * @param method the test method
     23      * @param description the description of the method
     24      * @param ignored true if the method should be ignore, either because the method has the
     25      *     {@link Ignore} annotation, or because it is parameterised but is given no parameters.
     26      */
     27     NonParameterisedFrameworkMethod(Method method, Description description, boolean ignored) {
     28         super(method, description);
     29         this.ignored = ignored;
     30     }
     31 
     32     @Override
     33     public Statement getInvokeStatement(Object test) {
     34         return new InvokeNonParameterisedMethod(this, test);
     35     }
     36 
     37     @Override
     38     public void run(MethodBlockSupplier supplier, RunNotifier notifier) {
     39         runMethodInvoker(notifier, supplier.getMethodBlock(this), getDescription());
     40     }
     41 
     42     public boolean isIgnored() {
     43         return ignored;
     44     }
     45 }
     46