1package junitparams.internal;
2
3import java.lang.reflect.Method;
4
5import org.junit.Ignore;
6import org.junit.runner.Description;
7import org.junit.runner.notification.RunNotifier;
8import org.junit.runners.model.FrameworkMethod;
9import org.junit.runners.model.Statement;
10
11/**
12 * A {@link FrameworkMethod} that represents an unparameterized method.
13 */
14public 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