- Revision
- 1097
- Author
- mauro
- Date
- 2009-02-22 06:40:48 -0600 (Sun, 22 Feb 2009)
Log Message
Added method to StepDoc.
Modified Paths
- trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepDocGeneratorBehaviour.java
- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepDocGenerator.java
- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/StepDoc.java
Diff
Modified: trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepDocGeneratorBehaviour.java (1096 => 1097)
--- trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepDocGeneratorBehaviour.java 2009-02-22 12:02:09 UTC (rev 1096) +++ trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepDocGeneratorBehaviour.java 2009-02-22 12:40:48 UTC (rev 1097) @@ -17,10 +17,13 @@ List<StepDoc> stepdocs = generator.generate(steps.getClass()); ensureThat(stepdocs.get(0).getPattern(), equalTo("a given")); ensureThat(stepdocs.get(0).getAliasPatterns(), equalTo(asList("a given alias", "another given alias"))); + ensureThat(stepdocs.get(0).getMethod().getName(), equalTo("given")); ensureThat(stepdocs.get(1).getPattern(), equalTo("a when")); ensureThat(stepdocs.get(1).getAliasPatterns(), equalTo(asList("a when alias", "another when alias"))); + ensureThat(stepdocs.get(1).getMethod().getName(), equalTo("when")); ensureThat(stepdocs.get(2).getPattern(), equalTo("a then")); ensureThat(stepdocs.get(2).getAliasPatterns(), equalTo(asList("a then alias", "another then alias"))); + ensureThat(stepdocs.get(2).getMethod().getName(), equalTo("then")); } public static class MySteps extends Steps {
Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepDocGenerator.java (1096 => 1097)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepDocGenerator.java 2009-02-22 12:02:09 UTC (rev 1096) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepDocGenerator.java 2009-02-22 12:40:48 UTC (rev 1097) @@ -17,15 +17,15 @@ for (Method method : stepsClass.getMethods()) { if (method.isAnnotationPresent(Given.class)) { stepdocs.add(new StepDoc(Given.class, method.getAnnotation(Given.class).value(), - aliases(method))); + aliases(method), method)); } if (method.isAnnotationPresent(When.class)) { stepdocs.add(new StepDoc(When.class, method.getAnnotation(When.class).value(), - aliases(method))); + aliases(method), method)); } if (method.isAnnotationPresent(Then.class)) { stepdocs.add(new StepDoc(Then.class, method.getAnnotation(Then.class).value(), - aliases(method))); + aliases(method), method)); } } Collections.sort(stepdocs);
Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/StepDoc.java (1096 => 1097)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/StepDoc.java 2009-02-22 12:02:09 UTC (rev 1096) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/StepDoc.java 2009-02-22 12:40:48 UTC (rev 1097) @@ -3,6 +3,7 @@ import static java.util.Arrays.asList; import java.lang.annotation.Annotation; +import java.lang.reflect.Method; import java.util.List; import org.jbehave.scenario.annotations.Given; @@ -13,14 +14,16 @@ private final Class<? extends Annotation> annotation; private final String pattern; - private final String[] aliasPatterns; + private final List<String> aliasPatterns; + private final Method method; private Integer priority = 0; public StepDoc(Class<? extends Annotation> annotation, String pattern, - String[] aliasPatterns) { + String[] aliasPatterns, Method method) { this.annotation = annotation; this.pattern = pattern; - this.aliasPatterns = aliasPatterns; + this.aliasPatterns = asList(aliasPatterns); + this.method = method; assignPriority(); } @@ -44,14 +47,18 @@ } public List<String> getAliasPatterns() { - return asList(aliasPatterns); + return aliasPatterns; } + + public Method getMethod() { + return method; + } @Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append("[StepDoc pattern=").append(pattern).append(", aliases=") - .append(asList(aliasPatterns)).append("]"); + .append(aliasPatterns).append(", method=").append(method).append("]"); return sb.toString(); }
To unsubscribe from this list please visit: