- Revision
- 1103
- Author
- mauro
- Date
- 2009-02-22 07:42:43 -0600 (Sun, 22 Feb 2009)
Log Message
Finished renaming StepDoc to Stepdoc.
Modified Paths
- trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioBehaviour.java
- trunk/core/jbehave-core/src/java/org/jbehave/scenario/AbstractScenario.java
- trunk/core/jbehave-core/src/java/org/jbehave/scenario/Configuration.java
- trunk/core/jbehave-core/src/java/org/jbehave/scenario/MostUsefulConfiguration.java
- trunk/core/jbehave-core/src/java/org/jbehave/scenario/PropertyBasedConfiguration.java
- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepdoc2Generator.java
Added Paths
- trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepdocGeneratorBehaviour.java
- trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/PrintStreamStepdocReporter.java
- trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/StepdocReporter.java
- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc.java
- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/StepdocGenerator.java
Removed Paths
- trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/Stepdoc2GeneratorBehaviour.java
- trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/PrintStreamStepdoc2Reporter.java
- trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/Stepdoc2Reporter.java
- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc2.java
- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc2Generator.java
Diff
Modified: trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioBehaviour.java (1102 => 1103)
--- trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioBehaviour.java 2009-02-22 13:40:34 UTC (rev 1102) +++ trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/ScenarioBehaviour.java 2009-02-22 13:42:43 UTC (rev 1103) @@ -13,10 +13,10 @@ import org.jbehave.scenario.errors.PendingErrorStrategy; import org.jbehave.scenario.parser.ScenarioDefiner; import org.jbehave.scenario.reporters.ScenarioReporter; -import org.jbehave.scenario.reporters.Stepdoc2Reporter; +import org.jbehave.scenario.reporters.StepdocReporter; import org.jbehave.scenario.steps.CandidateSteps; import org.jbehave.scenario.steps.StepCreator; -import org.jbehave.scenario.steps.Stepdoc2Generator; +import org.jbehave.scenario.steps.StepdocGenerator; import org.jbehave.scenario.steps.Steps; import org.junit.Test; @@ -67,9 +67,9 @@ public KeyWords keywords() { return null; } - public Stepdoc2Generator forGeneratingStepdoc() { return null; } + public StepdocGenerator forGeneratingStepdoc() { return null; } - public Stepdoc2Reporter forReportingStepdoc() { return null; } + public StepdocReporter forReportingStepdoc() { return null; } } }
Deleted: trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/Stepdoc2GeneratorBehaviour.java (1102 => 1103)
--- trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/Stepdoc2GeneratorBehaviour.java 2009-02-22 13:40:34 UTC (rev 1102) +++ trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/Stepdoc2GeneratorBehaviour.java 2009-02-22 13:42:43 UTC (rev 1103) @@ -1,55 +0,0 @@ -package org.jbehave.scenario.steps; - -import static java.util.Arrays.asList; -import static org.hamcrest.CoreMatchers.equalTo; -import static org.jbehave.Ensure.ensureThat; - -import java.util.List; - -import org.junit.Test; - -public class Stepdoc2GeneratorBehaviour { - - @Test - public void shouldGenerateStepdocsInPriorityOrder() { - Stepdoc2Generator generator = new DefaultStepdoc2Generator(); - MySteps steps = new MySteps(); - List<Stepdoc2> 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 { - - private int givens; - private int whens; - private int thens; - - @org.jbehave.scenario.annotations.Given("a given") - @org.jbehave.scenario.annotations.Aliases(values={"a given alias", "another given alias"}) - public void given() { - givens++; - } - - @org.jbehave.scenario.annotations.When("a when") - @org.jbehave.scenario.annotations.Aliases(values={"a when alias", "another when alias"}) - public void when() { - whens++; - } - - @org.jbehave.scenario.annotations.Then("a then") - @org.jbehave.scenario.annotations.Aliases(values={"a then alias", "another then alias"}) - public void then() { - thens++; - } - - } - -}
Copied: trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepdocGeneratorBehaviour.java (from rev 1102, trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/Stepdoc2GeneratorBehaviour.java) (0 => 1103)
--- trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepdocGeneratorBehaviour.java (rev 0) +++ trunk/core/jbehave-core/src/behaviour/org/jbehave/scenario/steps/StepdocGeneratorBehaviour.java 2009-02-22 13:42:43 UTC (rev 1103) @@ -0,0 +1,55 @@ +package org.jbehave.scenario.steps; + +import static java.util.Arrays.asList; +import static org.hamcrest.CoreMatchers.equalTo; +import static org.jbehave.Ensure.ensureThat; + +import java.util.List; + +import org.junit.Test; + +public class StepdocGeneratorBehaviour { + + @Test + public void shouldGenerateStepdocsInPriorityOrder() { + StepdocGenerator generator = new DefaultStepdoc2Generator(); + MySteps steps = new MySteps(); + 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 { + + private int givens; + private int whens; + private int thens; + + @org.jbehave.scenario.annotations.Given("a given") + @org.jbehave.scenario.annotations.Aliases(values={"a given alias", "another given alias"}) + public void given() { + givens++; + } + + @org.jbehave.scenario.annotations.When("a when") + @org.jbehave.scenario.annotations.Aliases(values={"a when alias", "another when alias"}) + public void when() { + whens++; + } + + @org.jbehave.scenario.annotations.Then("a then") + @org.jbehave.scenario.annotations.Aliases(values={"a then alias", "another then alias"}) + public void then() { + thens++; + } + + } + +}
Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/AbstractScenario.java (1102 => 1103)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/AbstractScenario.java 2009-02-22 13:40:34 UTC (rev 1102) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/AbstractScenario.java 2009-02-22 13:42:43 UTC (rev 1103) @@ -8,10 +8,10 @@ import org.jbehave.scenario.definition.KeyWords; import org.jbehave.scenario.definition.StoryDefinition; import org.jbehave.scenario.parser.ScenarioNameResolver; -import org.jbehave.scenario.reporters.Stepdoc2Reporter; +import org.jbehave.scenario.reporters.StepdocReporter; import org.jbehave.scenario.steps.CandidateSteps; -import org.jbehave.scenario.steps.Stepdoc2; -import org.jbehave.scenario.steps.Stepdoc2Generator; +import org.jbehave.scenario.steps.Stepdoc; +import org.jbehave.scenario.steps.StepdocGenerator; /** * <p> @@ -84,10 +84,10 @@ } public void generateStepdoc(){ - Stepdoc2Generator generator = configuration.forGeneratingStepdoc(); + StepdocGenerator generator = configuration.forGeneratingStepdoc(); for ( CandidateSteps steps : candidateSteps ){ - List<Stepdoc2> stepdocs = generator.generate(steps.getClass()); - Stepdoc2Reporter reporter = configuration.forReportingStepdoc(); + List<Stepdoc> stepdocs = generator.generate(steps.getClass()); + StepdocReporter reporter = configuration.forReportingStepdoc(); reporter.report(stepdocs); } }
Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/Configuration.java (1102 => 1103)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/Configuration.java 2009-02-22 13:40:34 UTC (rev 1102) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/Configuration.java 2009-02-22 13:42:43 UTC (rev 1103) @@ -5,9 +5,9 @@ import org.jbehave.scenario.errors.PendingErrorStrategy; import org.jbehave.scenario.parser.ScenarioDefiner; import org.jbehave.scenario.reporters.ScenarioReporter; -import org.jbehave.scenario.reporters.Stepdoc2Reporter; +import org.jbehave.scenario.reporters.StepdocReporter; import org.jbehave.scenario.steps.StepCreator; -import org.jbehave.scenario.steps.Stepdoc2Generator; +import org.jbehave.scenario.steps.StepdocGenerator; /** * Provides the configuration with which JBehave runs. @@ -37,8 +37,8 @@ KeyWords keywords(); - Stepdoc2Generator forGeneratingStepdoc(); + StepdocGenerator forGeneratingStepdoc(); - Stepdoc2Reporter forReportingStepdoc(); + StepdocReporter forReportingStepdoc(); }
Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/MostUsefulConfiguration.java (1102 => 1103)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/MostUsefulConfiguration.java 2009-02-22 13:40:34 UTC (rev 1102) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/MostUsefulConfiguration.java 2009-02-22 13:42:43 UTC (rev 1103) @@ -9,12 +9,12 @@ import org.jbehave.scenario.parser.ScenarioDefiner; import org.jbehave.scenario.reporters.PassSilentlyDecorator; import org.jbehave.scenario.reporters.PrintStreamScenarioReporter; -import org.jbehave.scenario.reporters.PrintStreamStepdoc2Reporter; +import org.jbehave.scenario.reporters.PrintStreamStepdocReporter; import org.jbehave.scenario.reporters.ScenarioReporter; -import org.jbehave.scenario.reporters.Stepdoc2Reporter; +import org.jbehave.scenario.reporters.StepdocReporter; import org.jbehave.scenario.steps.DefaultStepdoc2Generator; import org.jbehave.scenario.steps.StepCreator; -import org.jbehave.scenario.steps.Stepdoc2Generator; +import org.jbehave.scenario.steps.StepdocGenerator; import org.jbehave.scenario.steps.UnmatchedToPendingStepCreator; /** @@ -86,12 +86,12 @@ return new ScenarioGivenWhenThenAnd(); } - public Stepdoc2Generator forGeneratingStepdoc() { + public StepdocGenerator forGeneratingStepdoc() { return new DefaultStepdoc2Generator(); } - public Stepdoc2Reporter forReportingStepdoc() { - return new PrintStreamStepdoc2Reporter(); + public StepdocReporter forReportingStepdoc() { + return new PrintStreamStepdocReporter(); } }
Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/PropertyBasedConfiguration.java (1102 => 1103)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/PropertyBasedConfiguration.java 2009-02-22 13:40:34 UTC (rev 1102) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/PropertyBasedConfiguration.java 2009-02-22 13:42:43 UTC (rev 1103) @@ -6,9 +6,9 @@ import org.jbehave.scenario.parser.ScenarioDefiner; import org.jbehave.scenario.reporters.PrintStreamScenarioReporter; import org.jbehave.scenario.reporters.ScenarioReporter; -import org.jbehave.scenario.reporters.Stepdoc2Reporter; +import org.jbehave.scenario.reporters.StepdocReporter; import org.jbehave.scenario.steps.StepCreator; -import org.jbehave.scenario.steps.Stepdoc2Generator; +import org.jbehave.scenario.steps.StepdocGenerator; /** * This is backed by the MostUsefulConfiguration, but has different @@ -91,11 +91,11 @@ return defaults.keywords(); } - public Stepdoc2Generator forGeneratingStepdoc() { + public StepdocGenerator forGeneratingStepdoc() { return defaults.forGeneratingStepdoc(); } - public Stepdoc2Reporter forReportingStepdoc() { + public StepdocReporter forReportingStepdoc() { return defaults.forReportingStepdoc(); }
Deleted: trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/PrintStreamStepdoc2Reporter.java (1102 => 1103)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/PrintStreamStepdoc2Reporter.java 2009-02-22 13:40:34 UTC (rev 1102) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/PrintStreamStepdoc2Reporter.java 2009-02-22 13:42:43 UTC (rev 1103) @@ -1,44 +0,0 @@ -package org.jbehave.scenario.reporters; - -import java.io.PrintStream; -import java.util.List; - -import org.jbehave.scenario.steps.Stepdoc2; - -/** - * <p> - * Stepdoc2 reporter that outputs to a PrintStream, defaulting to System.out. - * </p> - */ -public class PrintStreamStepdoc2Reporter implements Stepdoc2Reporter { - - private final PrintStream output; - private final boolean reportMethods; - - public PrintStreamStepdoc2Reporter() { - this(System.out); - } - - public PrintStreamStepdoc2Reporter(PrintStream output) { - this(output, false); - } - - public PrintStreamStepdoc2Reporter(PrintStream output, boolean reportMethods) { - this.output = output; - this.reportMethods = reportMethods; - } - - public void report(List<Stepdoc2> stepdocs) { - for (Stepdoc2 stepdoc : stepdocs) { - output.println(stepdoc.getAnnotation().getSimpleName() + " " - + stepdoc.getPattern()); - if (stepdoc.getAliasPatterns().size() > 0) { - output.println("Aliases: " + stepdoc.getAliasPatterns()); - } - if (reportMethods) { - output.println("Method: " + stepdoc.getMethod()); - } - } - } - -}
Copied: trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/PrintStreamStepdocReporter.java (from rev 1101, trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/PrintStreamStepdoc2Reporter.java) (0 => 1103)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/PrintStreamStepdocReporter.java (rev 0) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/PrintStreamStepdocReporter.java 2009-02-22 13:42:43 UTC (rev 1103) @@ -0,0 +1,44 @@ +package org.jbehave.scenario.reporters; + +import java.io.PrintStream; +import java.util.List; + +import org.jbehave.scenario.steps.Stepdoc; + +/** + * <p> + * Stepdoc reporter that outputs to a PrintStream, defaulting to System.out. + * </p> + */ +public class PrintStreamStepdocReporter implements StepdocReporter { + + private final PrintStream output; + private final boolean reportMethods; + + public PrintStreamStepdocReporter() { + this(System.out); + } + + public PrintStreamStepdocReporter(PrintStream output) { + this(output, false); + } + + public PrintStreamStepdocReporter(PrintStream output, boolean reportMethods) { + this.output = output; + this.reportMethods = reportMethods; + } + + public void report(List<Stepdoc> stepdocs) { + for (Stepdoc stepdoc : stepdocs) { + output.println(stepdoc.getAnnotation().getSimpleName() + " " + + stepdoc.getPattern()); + if (stepdoc.getAliasPatterns().size() > 0) { + output.println("Aliases: " + stepdoc.getAliasPatterns()); + } + if (reportMethods) { + output.println("Method: " + stepdoc.getMethod()); + } + } + } + +}
Deleted: trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/Stepdoc2Reporter.java (1102 => 1103)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/Stepdoc2Reporter.java 2009-02-22 13:40:34 UTC (rev 1102) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/Stepdoc2Reporter.java 2009-02-22 13:42:43 UTC (rev 1103) @@ -1,16 +0,0 @@ -package org.jbehave.scenario.reporters; - -import java.util.List; - -import org.jbehave.scenario.steps.Stepdoc2; - -/** - * Generates reports of generated StepDocs - * - * @author Mauro Talevi - */ -public interface Stepdoc2Reporter { - - void report(List<Stepdoc2> stepdocs); - -}
Copied: trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/StepdocReporter.java (from rev 1101, trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/Stepdoc2Reporter.java) (0 => 1103)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/StepdocReporter.java (rev 0) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/reporters/StepdocReporter.java 2009-02-22 13:42:43 UTC (rev 1103) @@ -0,0 +1,16 @@ +package org.jbehave.scenario.reporters; + +import java.util.List; + +import org.jbehave.scenario.steps.Stepdoc; + +/** + * Generates reports of generated StepDocs + * + * @author Mauro Talevi + */ +public interface StepdocReporter { + + void report(List<Stepdoc> stepdocs); + +}
Modified: trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepdoc2Generator.java (1102 => 1103)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepdoc2Generator.java 2009-02-22 13:40:34 UTC (rev 1102) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/DefaultStepdoc2Generator.java 2009-02-22 13:42:43 UTC (rev 1103) @@ -10,21 +10,21 @@ import org.jbehave.scenario.annotations.Then; import org.jbehave.scenario.annotations.When; -public class DefaultStepdoc2Generator implements Stepdoc2Generator { +public class DefaultStepdoc2Generator implements StepdocGenerator { - public List<Stepdoc2> generate(Class<?> stepsClass) { - List<Stepdoc2> stepdocs = new LinkedList<Stepdoc2>(); + public List<Stepdoc> generate(Class<?> stepsClass) { + List<Stepdoc> stepdocs = new LinkedList<Stepdoc>(); for (Method method : stepsClass.getMethods()) { if (method.isAnnotationPresent(Given.class)) { - stepdocs.add(new Stepdoc2(Given.class, method.getAnnotation(Given.class).value(), + stepdocs.add(new Stepdoc(Given.class, method.getAnnotation(Given.class).value(), aliases(method), method)); } if (method.isAnnotationPresent(When.class)) { - stepdocs.add(new Stepdoc2(When.class, method.getAnnotation(When.class).value(), + stepdocs.add(new Stepdoc(When.class, method.getAnnotation(When.class).value(), aliases(method), method)); } if (method.isAnnotationPresent(Then.class)) { - stepdocs.add(new Stepdoc2(Then.class, method.getAnnotation(Then.class).value(), + stepdocs.add(new Stepdoc(Then.class, method.getAnnotation(Then.class).value(), aliases(method), method)); } }
Copied: trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc.java (from rev 1101, trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc2.java) (0 => 1103)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc.java (rev 0) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc.java 2009-02-22 13:42:43 UTC (rev 1103) @@ -0,0 +1,68 @@ +package org.jbehave.scenario.steps; + +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; +import org.jbehave.scenario.annotations.Then; +import org.jbehave.scenario.annotations.When; + +public class Stepdoc implements Comparable<Stepdoc> { + + private final Class<? extends Annotation> annotation; + private final String pattern; + private final List<String> aliasPatterns; + private final Method method; + private Integer priority = 0; + + public Stepdoc(Class<? extends Annotation> annotation, String pattern, + String[] aliasPatterns, Method method) { + this.annotation = annotation; + this.pattern = pattern; + this.aliasPatterns = asList(aliasPatterns); + this.method = method; + assignPriority(); + } + + private void assignPriority() { + if (annotation.equals(Given.class)) { + priority = 1; + } else if (annotation.equals(When.class)) { + priority = 2; + } else if (annotation.equals(Then.class)) { + priority = 3; + } + + } + + public Class<? extends Annotation> getAnnotation() { + return annotation; + } + + public String getPattern() { + return pattern; + } + + public List<String> getAliasPatterns() { + return aliasPatterns; + } + + public Method getMethod() { + return method; + } + + @Override + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append("[Stepdoc pattern=").append(pattern).append(", aliases=") + .append(aliasPatterns).append(", method=").append(method).append("]"); + return sb.toString(); + } + + public int compareTo(Stepdoc that) { + return this.priority.compareTo(that.priority); + } +}
Deleted: trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc2.java (1102 => 1103)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc2.java 2009-02-22 13:40:34 UTC (rev 1102) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc2.java 2009-02-22 13:42:43 UTC (rev 1103) @@ -1,68 +0,0 @@ -package org.jbehave.scenario.steps; - -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; -import org.jbehave.scenario.annotations.Then; -import org.jbehave.scenario.annotations.When; - -public class Stepdoc2 implements Comparable<Stepdoc2> { - - private final Class<? extends Annotation> annotation; - private final String pattern; - private final List<String> aliasPatterns; - private final Method method; - private Integer priority = 0; - - public Stepdoc2(Class<? extends Annotation> annotation, String pattern, - String[] aliasPatterns, Method method) { - this.annotation = annotation; - this.pattern = pattern; - this.aliasPatterns = asList(aliasPatterns); - this.method = method; - assignPriority(); - } - - private void assignPriority() { - if (annotation.equals(Given.class)) { - priority = 1; - } else if (annotation.equals(When.class)) { - priority = 2; - } else if (annotation.equals(Then.class)) { - priority = 3; - } - - } - - public Class<? extends Annotation> getAnnotation() { - return annotation; - } - - public String getPattern() { - return pattern; - } - - public List<String> getAliasPatterns() { - return aliasPatterns; - } - - public Method getMethod() { - return method; - } - - @Override - public String toString() { - StringBuffer sb = new StringBuffer(); - sb.append("[Stepdoc2 pattern=").append(pattern).append(", aliases=") - .append(aliasPatterns).append(", method=").append(method).append("]"); - return sb.toString(); - } - - public int compareTo(Stepdoc2 that) { - return this.priority.compareTo(that.priority); - } -}
Deleted: trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc2Generator.java (1102 => 1103)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc2Generator.java 2009-02-22 13:40:34 UTC (rev 1102) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc2Generator.java 2009-02-22 13:42:43 UTC (rev 1103) @@ -1,9 +0,0 @@ -package org.jbehave.scenario.steps; - -import java.util.List; - -public interface Stepdoc2Generator { - - List<Stepdoc2> generate(Class<?> stepsClass); - -}
Copied: trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/StepdocGenerator.java (from rev 1101, trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/Stepdoc2Generator.java) (0 => 1103)
--- trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/StepdocGenerator.java (rev 0) +++ trunk/core/jbehave-core/src/java/org/jbehave/scenario/steps/StepdocGenerator.java 2009-02-22 13:42:43 UTC (rev 1103) @@ -0,0 +1,9 @@ +package org.jbehave.scenario.steps; + +import java.util.List; + +public interface StepdocGenerator { + + List<Stepdoc> generate(Class<?> stepsClass); + +}
To unsubscribe from this list please visit:
