commit bd4b84609ea63a3469ea1550af98b68b662348be
Author: Alex Lehmann <[email protected]>
AuthorDate: Fri Mar 16 00:17:14 2012 +0100
Commit: Mauro Talevi <[email protected]>
CommitDate: Fri Mar 16 14:00:54 2012 +0100
JBEHAVE-744: Unit test
CompositeStepCandidateBehaviour.shouldMatchCompositeStepsAndCreateComposedNestedSteps
can fail due to random list ordering
added lookup for base step
diff --git
a/jbehave-core/src/test/java/org/jbehave/core/steps/CompositeStepCandidateBehaviour.java
b/jbehave-core/src/test/java/org/jbehave/core/steps/CompositeStepCandidateBehaviour.java
index 5e00bc5..d1e98bf 100755
---
a/jbehave-core/src/test/java/org/jbehave/core/steps/CompositeStepCandidateBehaviour.java
+++
b/jbehave-core/src/test/java/org/jbehave/core/steps/CompositeStepCandidateBehaviour.java
@@ -17,6 +17,7 @@ import java.util.Map;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertNotNull;
public class CompositeStepCandidateBehaviour {
@@ -151,7 +152,15 @@ public class CompositeStepCandidateBehaviour {
public void shouldMatchCompositeStepsAndCreateComposedNestedSteps() {
CompositeNestedSteps steps = new CompositeNestedSteps();
List<StepCandidate> candidates = steps.listCandidates();
- StepCandidate candidate = candidates.get(0);
+ // find main step
+ StepCandidate candidate = null;
+ for(StepCandidate cand: candidates) {
+ if(cand.getPatternAsString().equals("all buttons are enabled")) {
+ candidate = cand;
+ break;
+ }
+ }
+ assertNotNull(candidate);
assertThat(candidate.isComposite(), is(true));
Map<String, String> noNamedParameters = new HashMap<String, String>();
List<Step> composedSteps = new ArrayList<Step>();