use of cucumber.runtime.java.Java8StepDefinition in project cucumber-jvm by cucumber.
the class Java8StepDefinitionTest method should_pass_for_param_with_generic_list.
@Test
public void should_pass_for_param_with_generic_list() throws Exception {
try {
StepdefBody body = (StepdefBody.A1<List<String>>) p1 -> {
};
new Java8StepDefinition(Pattern.compile("^I have (\\d) some step (.*)$"), 0, body, typeIntrospector);
} catch (CucumberException expected) {
assertEquals("Can't use java.util.List in lambda step definition. Declare a DataTable argument instead and convert manually with asList/asLists/asMap/asMaps", expected.getMessage());
}
}
use of cucumber.runtime.java.Java8StepDefinition in project cucumber-jvm by cucumber.
the class Java8StepDefinitionTest method should_calculate_parameters_count_from_body_with_one_param.
@Test
public void should_calculate_parameters_count_from_body_with_one_param() throws Exception {
StepdefBody body = (StepdefBody.A1<String>) p1 -> {
};
Java8StepDefinition def = new Java8StepDefinition(Pattern.compile("^I have (\\d) some step (.*)$"), 0, body, typeIntrospector);
assertEquals(new Integer(1), def.getParameterCount());
}
use of cucumber.runtime.java.Java8StepDefinition in project cucumber-jvm by cucumber.
the class Java8StepDefinitionTest method should_fail_for_param_with_non_generic_list.
@Test
public void should_fail_for_param_with_non_generic_list() throws Exception {
try {
StepdefBody body = (StepdefBody.A1<List>) p1 -> {
};
new Java8StepDefinition(Pattern.compile("^I have (\\d) some step (.*)$"), 0, body, typeIntrospector);
} catch (CucumberException expected) {
assertEquals("Can't use java.util.List in lambda step definition. Declare a DataTable argument instead and convert manually with asList/asLists/asMap/asMaps", expected.getMessage());
}
}
use of cucumber.runtime.java.Java8StepDefinition in project cucumber-jvm by cucumber.
the class Java8StepDefinitionTest method should_calculate_parameters_count_from_body_with_two_params.
@Test
public void should_calculate_parameters_count_from_body_with_two_params() throws Exception {
StepdefBody body = (StepdefBody.A2<String, String>) (p1, p2) -> {
};
Java8StepDefinition def = new Java8StepDefinition(Pattern.compile("^I have some step $"), 0, body, typeIntrospector);
assertEquals(new Integer(2), def.getParameterCount());
}
Aggregations