Title: [1097] trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps: Added method to StepDoc.

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:

http://xircles.codehaus.org/manage_email

Reply via email to