Search in sources :

Example 36 with CucumberException

use of cucumber.runtime.CucumberException in project cucumber-jvm by cucumber.

the class HooksTest method only_allows_arguments_string_long_integer_closure.

@Test
public void only_allows_arguments_string_long_integer_closure() {
    try {
        Hooks.Before("TAG", 10L, 100, new MethodClosure(this, "dummyClosureCall"), 0.0);
        fail("CucumberException was not thrown");
    } catch (CucumberException e) {
        assertEquals("An argument of the type java.lang.Double found, Before only allows the argument types " + "String - Tag, Long - timeout, Integer - order, and Closure", e.getMessage());
    }
}
Also used : CucumberException(cucumber.runtime.CucumberException) MethodClosure(org.codehaus.groovy.runtime.MethodClosure) Test(org.junit.Test)

Example 37 with CucumberException

use of cucumber.runtime.CucumberException in project allure-cucumberjvm by allure-framework.

the class AllureReporter method extractStep.

private Step extractStep(StepDefinitionMatch match) {
    try {
        Field step = match.getClass().getDeclaredField("step");
        step.setAccessible(true);
        return (Step) step.get(match);
    } catch (ReflectiveOperationException e) {
        // shouldn't ever happen
        LOG.error(e.getMessage(), e);
        throw new CucumberException(e);
    }
}
Also used : Field(java.lang.reflect.Field) Step(gherkin.formatter.model.Step) CucumberException(cucumber.runtime.CucumberException)

Aggregations

CucumberException (cucumber.runtime.CucumberException)37 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)6 SingleValueConverter (cucumber.deps.com.thoughtworks.xstream.converters.SingleValueConverter)4 IOException (java.io.IOException)4 Step (gherkin.formatter.model.Step)3 ObjectFactory (cucumber.api.java.ObjectFactory)2 StepdefBody (cucumber.api.java8.StepdefBody)2 RuntimeOptionsFactory (cucumber.runtime.RuntimeOptionsFactory)2 Resource (cucumber.runtime.io.Resource)2 Java8StepDefinition (cucumber.runtime.java.Java8StepDefinition)2 AssetManager (android.content.res.AssetManager)1 DataTable (cucumber.api.DataTable)1 PendingException (cucumber.api.PendingException)1 Scenario (cucumber.api.Scenario)1 After (cucumber.api.java.After)1 Cucumber (cucumber.api.junit.Cucumber)1 OsgiClassFinder (cucumber.java.runtime.osgi.OsgiClassFinder)1 PaxExamObjectFactory (cucumber.java.runtime.osgi.PaxExamObjectFactory)1 Backend (cucumber.runtime.Backend)1