aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/junitparams/internal/NonParameterisedFrameworkMethod.java
blob: 0e2d297748d2ce769df76aea6caaa93e74764f06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package junitparams.internal;

import java.lang.reflect.Method;

import org.junit.Ignore;
import org.junit.runner.Description;
import org.junit.runner.notification.RunNotifier;
import org.junit.runners.model.FrameworkMethod;
import org.junit.runners.model.Statement;

/**
 * A {@link FrameworkMethod} that represents an unparameterized method.
 */
public class NonParameterisedFrameworkMethod
        extends InvokableFrameworkMethod {

    private final boolean ignored;

    /**
     * Create a non-parameterised method.
     *
     * @param method the test method
     * @param description the description of the method
     * @param ignored true if the method should be ignore, either because the method has the
     *     {@link Ignore} annotation, or because it is parameterised but is given no parameters.
     */
    NonParameterisedFrameworkMethod(Method method, Description description, boolean ignored) {
        super(method, description);
        this.ignored = ignored;
    }

    @Override
    public Statement getInvokeStatement(Object test) {
        return new InvokeNonParameterisedMethod(this, test);
    }

    @Override
    public void run(MethodBlockSupplier supplier, RunNotifier notifier) {
        runMethodInvoker(notifier, supplier.getMethodBlock(this), getDescription());
    }

    public boolean isIgnored() {
        return ignored;
    }
}