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

io.cucumber.java.JavaStepDefinition Maven / Gradle / Ivy

There is a newer version: 7.20.1
Show newest version
package io.cucumber.java;

import io.cucumber.core.backend.Lookup;
import io.cucumber.core.backend.ParameterInfo;
import io.cucumber.core.backend.StepDefinition;

import java.lang.reflect.Method;
import java.util.List;

import static java.util.Objects.requireNonNull;

final class JavaStepDefinition extends AbstractGlueDefinition implements StepDefinition {
    private final String expression;

    private final List parameterInfos;

    JavaStepDefinition(Method method,
                       String expression,
                       Lookup lookup) {
        super(method, lookup);
        this.parameterInfos = JavaParameterInfo.fromMethod(method);
        this.expression = requireNonNull(expression, "cucumber-expression may not be null");
    }

    @Override
    public void execute(Object[] args) {
        Invoker.invoke(this, lookup.getInstance(method.getDeclaringClass()), method, args);
    }

    @Override
    public String getPattern() {
        return expression;
    }

    @Override
    public List parameterInfos() {
        return parameterInfos;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy