Skip to content

Commit 6f6aba0

Browse files
committed
Disclose that spring step def injection does not work
1 parent acc3050 commit 6f6aba0

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package cucumber.runtime.java.spring;
2+
3+
import cucumber.api.java.en.Then;
4+
import org.springframework.beans.factory.annotation.Autowired;
5+
import org.springframework.test.context.ContextConfiguration;
6+
7+
import static org.junit.Assert.assertEquals;
8+
9+
@ContextConfiguration("classpath:cucumber.xml")
10+
public class AnotherStepDef {
11+
12+
@Autowired
13+
OneStepDef oneStepDef;
14+
15+
@Then("^I can read (\\d+) cucumbers from the other step def class$")
16+
public void i_can_read_cucumbers_from_the_other_step_def_class(int arg1) throws Throwable {
17+
assertEquals(arg1, oneStepDef.cucumbers);
18+
}
19+
20+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package cucumber.runtime.java.spring;
2+
3+
import cucumber.api.java.en.Given;
4+
import cucumber.api.java.en.When;
5+
import org.springframework.test.context.ContextConfiguration;
6+
7+
@ContextConfiguration("classpath:cucumber.xml")
8+
public class OneStepDef {
9+
int cucumbers;
10+
11+
@Given("^the StepDef injection works$")
12+
public void the_StepDef_injection_works() throws Throwable {
13+
// blank
14+
}
15+
16+
@When("^I assign the \"cucumbers\" attribute to (\\d+) in one step def class$")
17+
public void i_assign_the_cucumbers_attribute_to_in_one_step_def_class(int arg1) throws Throwable {
18+
cucumbers = arg1;
19+
}
20+
21+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Feature: StepDef injection
2+
3+
Scenario: StepDef injection
4+
Given the StepDef injection works
5+
When I assign the "cucumbers" attribute to 4 in one step def class
6+
Then I can read 4 cucumbers from the other step def class

0 commit comments

Comments
 (0)