- Revision
- 1512
- Author
- paul
- Date
- 2010-01-09 20:26:45 -0600 (Sat, 09 Jan 2010)
Log Message
less code
Modified Paths
Diff
Modified: sandbox/spikes/di-spike/jbehave-pico/src/main/java/org/jbehave/scenario/steps/pico/PicoStepsFactory.java (1511 => 1512)
--- sandbox/spikes/di-spike/jbehave-pico/src/main/java/org/jbehave/scenario/steps/pico/PicoStepsFactory.java 2010-01-10 02:11:31 UTC (rev 1511) +++ sandbox/spikes/di-spike/jbehave-pico/src/main/java/org/jbehave/scenario/steps/pico/PicoStepsFactory.java 2010-01-10 02:26:45 UTC (rev 1512) @@ -1,8 +1,5 @@ package org.jbehave.scenario.steps.pico; -import org.jbehave.scenario.annotations.Given; -import org.jbehave.scenario.annotations.Then; -import org.jbehave.scenario.annotations.When; import org.jbehave.scenario.steps.CandidateSteps; import org.jbehave.scenario.steps.Steps; import org.jbehave.scenario.steps.StepsConfiguration; @@ -12,7 +9,6 @@ import java.lang.annotation.Annotation; import java.lang.reflect.Method; import java.util.ArrayList; -import java.util.Collection; import java.util.List; public class PicoStepsFactory { @@ -25,13 +21,9 @@ } public CandidateSteps[] createCandidateSteps() { - - List<CandidateSteps> steps = new ArrayList<CandidateSteps>(); - - Collection<ComponentAdapter<?>> adapters = parent.getComponentAdapters(); - for (ComponentAdapter<?> componentAdapter : adapters) { - Class<?> impl = componentAdapter.getComponentImplementation(); - Method[] methods = impl.getMethods(); + List<Steps> steps = new ArrayList<Steps>(); + for (ComponentAdapter<?> componentAdapter : parent.getComponentAdapters()) { + Method[] methods = componentAdapter.getComponentImplementation().getMethods(); if (isStep(methods)) { steps.add(new Steps(configuration, parent.getComponent(componentAdapter.getComponentKey()))); } @@ -41,9 +33,8 @@ private boolean isStep(Method[] methods) { for (Method method : methods) { - Annotation[] anns = method.getAnnotations(); - for (Annotation ann : anns) { - if (ann.annotationType() == Given.class || ann.annotationType() == When.class || ann.annotationType() == Then.class) { + for (Annotation ann : method.getAnnotations()) { + if (ann.annotationType().getName().startsWith("org.jbehave.scenario.annotations")) { return true; } }
To unsubscribe from this list please visit:
