- Revision
- 1110
- Author
- mauro
- Date
- 2009-02-22 17:45:39 -0600 (Sun, 22 Feb 2009)
Log Message
Minor rewordings.
Modified Paths
- trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepdocGeneratorBehaviour.java
- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc.java
- trunk/web/web-waffle/src/main/webapp/ftl/scenario/stepdoc.ftl
Diff
Modified: trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepdocGeneratorBehaviour.java (1109 => 1110)
--- trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepdocGeneratorBehaviour.java 2009-02-22 19:47:21 UTC (rev 1109) +++ trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepdocGeneratorBehaviour.java 2009-02-22 23:45:39 UTC (rev 1110) @@ -34,10 +34,10 @@ StepdocGenerator generator = new DefaultStepdocGenerator(); MoreSteps steps = new MoreSteps(); List<Stepdoc> stepdocs = generator.generate(steps.getClass()); - ensureThat(stepdocs.get(0).getSignature(), equalTo("org.jbehave.scenario.steps.StepdocGeneratorBehaviour$MoreSteps.givenAbc(int,int)")); - ensureThat(stepdocs.get(1).getSignature(), equalTo("org.jbehave.scenario.steps.StepdocGeneratorBehaviour$MoreSteps.whenAbc(int,int)")); - ensureThat(stepdocs.get(2).getSignature(), equalTo("org.jbehave.scenario.steps.StepdocGeneratorBehaviour$MoreSteps.whenXyz(int,int)")); - ensureThat(stepdocs.get(3).getSignature(), equalTo("org.jbehave.scenario.steps.StepdocGeneratorBehaviour$MoreSteps.thenAbc(int,int)")); + ensureThat(stepdocs.get(0).getMethodSignature(), equalTo("org.jbehave.scenario.steps.StepdocGeneratorBehaviour$MoreSteps.givenAbc(int,int)")); + ensureThat(stepdocs.get(1).getMethodSignature(), equalTo("org.jbehave.scenario.steps.StepdocGeneratorBehaviour$MoreSteps.whenAbc(int,int)")); + ensureThat(stepdocs.get(2).getMethodSignature(), equalTo("org.jbehave.scenario.steps.StepdocGeneratorBehaviour$MoreSteps.whenXyz(int,int)")); + ensureThat(stepdocs.get(3).getMethodSignature(), equalTo("org.jbehave.scenario.steps.StepdocGeneratorBehaviour$MoreSteps.thenAbc(int,int)")); } @Test @@ -49,15 +49,13 @@ Stepdoc when2 = stepdocs.get(2); ensureThat(when1.compareTo(when2), lessThan(0)); - ensureThat(when2.compareTo(when1), greaterThan(0)); } private Matcher<Integer> lessThan(final int i) { return new BaseMatcher<Integer>() { public boolean matches(Object o) { - int i1 = ((Integer) o).compareTo(i); - return i1 < 0; + return ((Integer) o).compareTo(i) < 0; } public void describeTo(Description description) { @@ -69,8 +67,7 @@ private Matcher<Integer> greaterThan(final int i) { return new BaseMatcher<Integer>() { public boolean matches(Object o) { - int i1 = ((Integer) o).compareTo(i); - return i1 > 0; + return ((Integer) o).compareTo(i) > 0; } public void describeTo(Description description) {
Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc.java (1109 => 1110)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc.java 2009-02-22 19:47:21 UTC (rev 1109) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc.java 2009-02-22 23:45:39 UTC (rev 1110) @@ -4,7 +4,6 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Method; -import java.lang.reflect.Type; import java.util.List; import org.jbehave.scenario.annotations.Given; @@ -56,29 +55,27 @@ } /** - * Method signature without "public void" (etc) prefix - * @return + * Method signature without "public void" prefix + * @return The method signature in String format */ - public String getSignature() { + public String getMethodSignature() { String methodSignature = method.toString(); - int ix = methodSignature.indexOf(" "); - ix = methodSignature.indexOf(" ", ix+1); - return methodSignature.substring(ix+1); + return methodSignature.replaceFirst("public void ", ""); } @Override public String toString() { StringBuffer sb = new StringBuffer(); sb.append("[Stepdoc pattern=").append(pattern).append(", aliases=") - .append(aliasPatterns).append(", method=").append(getSignature()).append("]"); + .append(aliasPatterns).append(", method=").append(getMethodSignature()).append("]"); return sb.toString(); } public int compareTo(Stepdoc that) { - int retVal = this.priority.compareTo(that.priority); - if (retVal == 0) { - retVal = this.getPattern().compareTo(that.getPattern()); + int compare = this.priority.compareTo(that.priority); + if (compare == 0) { + compare = this.pattern.compareTo(that.pattern); } - return retVal; + return compare; } }
Modified: trunk/web/web-waffle/src/main/webapp/ftl/scenario/stepdoc.ftl (1109 => 1110)
--- trunk/web/web-waffle/src/main/webapp/ftl/scenario/stepdoc.ftl 2009-02-22 19:47:21 UTC (rev 1109) +++ trunk/web/web-waffle/src/main/webapp/ftl/scenario/stepdoc.ftl 2009-02-22 23:45:39 UTC (rev 1110) @@ -15,10 +15,10 @@ <div id="stepdocs"> <fieldset> <legend><@i.messageFor "stepdocs" "Stepdocs"/></legend> - <p><@i.messageFor "stepdocsDescription" "Listed steps are extracted from registered steps classes"/></p> - <p> - <@w.selectSingle "stepdocContext.view" w.asNameableValues(stepdocContext.getViews(),"name()","name()") stepdocContext.getView() /></td></tr> - <a "updateView" "Update View"/></a> + <p><@i.messageFor "stepdocsDescription" "The following stepdocs are automatically generated from the registered Java Steps class"/></p> + <p><@i.messageFor "view" "View"/> + <@w.selectSingle "stepdocContext.view" w.asNameableValues(stepdocContext.getViews(),"name()","name()") stepdocContext.getView() + " /> </p> <p> <pre class="brush: plain"> @@ -31,7 +31,7 @@ </#list> </#if> <#if (view == 'METHODS') > - ${stepdoc.signature} + ${stepdoc.methodSignature} </#if> </#list> </pre>
To unsubscribe from this list please visit: