here you go. Like I said, just to remove a field that is not really being used.
On a side note:
As I ran all the behaviours to make sure that everything still works,
I realized that we have reverted the behaviour collection to this:
public Class[] getBehaviours() {
return new Class[] {UsingCollectionMatchersBehaviour.class,
UsingEqualityMatchersBehaviour.class,
UsingLogicalMatchersBehaviour.class,
UsingExceptionsBehaviour.class,
UsingMatchersBehaviour.class,
UsingStringMatchersBehaviour.class,
BehaviourClassBehaviour.class,
BehaviourMethodBehaviour.class,
BehaviourVerifierBehaviour.class,
PlainTextMethodListenerBehaviour.class,
MiniMockObjectBehaviour.class,
UsingMiniMockBehaviour.class,
ExpectationBehaviour.class,
ResultBehaviour.class,
org.jbehave.core.story.AllBehaviours.class,
org.jbehave.core.matchers.AllBehaviours.class,
JBehaveFrameworkErrorBehaviour.class,
};
Com'on, you gota admit this is not going to scale and someone will
make a mistake sooner or later, if not already.
I know the reason behind removing the reference to cotta but I don't
think this is a working solution either. I think I have a good
solution. What about using cotta for test only. I have created a
jbehave extension in cotta and used it in my other projects so that
the behaviour collection is like this:
public Class[] getBehaviours() {
return new BehavioursLoader(getClass()).loadBehaviours();
}
On 8/30/07, Mauro Talevi <[EMAIL PROTECTED]> wrote:
> Dan North wrote:
> > Hi chaps.
> >
> > Shane, can you make your proposed change in a branch please and post us
> > the svn url so Mauro can pick it to pieces? :)
>
> That'd work. Or posting a patch would work as well.
>
> I'm off for weekend though, so I wouldn't get my chopsticks to it before next
> week!
>
> Cheers
>
>
--- core/src/java/org/jbehave/core/behaviour/BehaviourClass.java
(revision 786)
+++ core/src/java/org/jbehave/core/behaviour/BehaviourClass.java Mon Sep
03 14:52:00 PDT 2007
@@ -24,7 +24,6 @@
private static final String BEHAVIOUR_METHOD_PREFIX = "should";
private final Class classToVerify;
- private final BehaviourVerifier verifier;
private Matcher methodFilter;
public static final Matcher ALL_METHODS = new Matcher() {
public boolean matches(Object arg) {
@@ -36,19 +35,14 @@
return ((Method)
arg).getName().startsWith(BEHAVIOUR_METHOD_PREFIX);
}
};
-
+
public BehaviourClass(Class classToVerify) {
- this(classToVerify, new BehaviourVerifier());
+ this(classToVerify, "");
}
- public BehaviourClass(Class classToVerify, BehaviourVerifier verifier) {
- this(classToVerify, "", verifier);
- }
-
- public BehaviourClass(Class classToVerify, final String methodName,
BehaviourVerifier verifier) {
+ public BehaviourClass(Class classToVerify, final String methodName) {
this.classToVerify = classToVerify;
- this.verifier = verifier;
-
+
if (methodName.length() == 0) {
this.methodFilter = ALL_METHODS;
} else {
@@ -65,7 +59,7 @@
}
public void verifyTo(BehaviourListener listener) {
- traverseMethodsWith(new MethodVerifier(verifier, listener));
+ traverseMethodsWith(new MethodVerifier(listener));
}
public int countBehaviours() {
@@ -79,14 +73,14 @@
Method[] methods = getMethods(BEHAVIOUR_METHODS);
for (int i = 0; i < methods.length; i++) {
set.add(createBehaviourMethod(methods[i]));
- }
+ }
return (BehaviourMethod[]) set.toArray(new
BehaviourMethod[set.size()]);
}
-
+
public BehaviourMethod createBehaviourMethod(Method method) {
return new BehaviourMethod(createInstance(), method);
}
-
+
private Method[] getMethods(Matcher methodFilter){
Set set = new HashSet();
Method[] classMethods = classToVerify.getMethods();
@@ -95,16 +89,16 @@
if ( methodFilter.matches(method)) {
set.add(method);
}
- }
+ }
return (Method[]) set.toArray(new Method[set.size()]);
}
-
+
private void traverseMethodsWith(MethodHandler methodHandler) {
if (Behaviours.class.isAssignableFrom(classToVerify)) {
Behaviours behaviours = (Behaviours) createInstance();
Class[] nestedClasses = behaviours.getBehaviours();
for (int i = 0; i < nestedClasses.length; i++) {
- methodHandler.handleClass(new BehaviourClass(nestedClasses[i],
verifier));
+ methodHandler.handleClass(new
BehaviourClass(nestedClasses[i]));
}
}
Method[] methods = getMethods(BEHAVIOUR_METHODS);
@@ -135,10 +129,10 @@
public Class classToVerify() {
return classToVerify;
}
-
+
private static class MethodCounter implements MethodHandler {
int total = 0;
-
+
public void handleClass(BehaviourClass behaviourClass) {
total += behaviourClass.countBehaviours();
}
@@ -150,5 +144,5 @@
public int total() {
return total;
}
- }
+ }
}
--- core/src/java/org/jbehave/core/BehaviourRunner.java (revision 786)
+++ core/src/java/org/jbehave/core/BehaviourRunner.java Mon Sep 03 14:52:00 PDT
2007
@@ -53,7 +53,7 @@
public void verifyBehaviour(Class classToVerify, String methodName) {
PlainTextListener textListener = new PlainTextListener(new
PrintWriter(writer), new Timer());
BehaviourVerifier verifier = new BehaviourVerifier(textListener);
- verifier.verifyBehaviour(new BehaviourClass(classToVerify, methodName,
verifier));
+ verifier.verifyBehaviour(new BehaviourClass(classToVerify,
methodName));
textListener.printReport();
succeeded = succeeded && !textListener.hasBehaviourFailures();
}
--- extensions/junit/junit-extension.iml (revision 786)
+++ extensions/junit/junit-extension.iml Mon Sep 03 14:40:29 PDT 2007
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
+<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/classes" />
<exclude-output />
--- website/website.iml (revision 786)
+++ website/website.iml Mon Sep 03 14:40:29 PDT 2007
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
+<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/classes" />
<exclude-output />
--- extensions/swing/swing-extension.iml (revision 786)
+++ extensions/swing/swing-extension.iml Mon Sep 03 14:40:29 PDT 2007
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
+<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/classes" />
<exclude-output />
--- jbehave.ipr (revision 786)
+++ jbehave.ipr Mon Sep 03 15:33:15 PDT 2007
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project version="4" relativePaths="true">
+<project relativePaths="true" version="4">
<component name="AntConfiguration">
<defaultAnt bundledAnt="true" />
</component>
@@ -11,8 +11,20 @@
<option name="USE_PROJECT_LEVEL_SETTINGS" value="false" />
</component>
<component name="CodeStyleSettingsManager">
- <option name="PER_PROJECT_SETTINGS" />
- <option name="USE_PER_PROJECT_SETTINGS" value="false" />
+ <option name="PER_PROJECT_SETTINGS">
+ <value>
+ <ADDITIONAL_INDENT_OPTIONS fileType="js">
+ <option name="INDENT_SIZE" value="4" />
+ <option name="CONTINUATION_INDENT_SIZE" value="8" />
+ <option name="TAB_SIZE" value="4" />
+ <option name="USE_TAB_CHARACTER" value="false" />
+ <option name="SMART_TABS" value="false" />
+ <option name="LABEL_INDENT_SIZE" value="0" />
+ <option name="LABEL_INDENT_ABSOLUTE" value="false" />
+ </ADDITIONAL_INDENT_OPTIONS>
+ </value>
+ </option>
+ <option name="USE_PER_PROJECT_SETTINGS" value="true" />
</component>
<component name="CompilerConfiguration">
<option name="DEFAULT_COMPILER" value="Javac" />
@@ -32,13 +44,15 @@
<entry name="?*.dtd" />
<entry name="?*.tld" />
<entry name="*.dat" />
+ <entry name="*.template" />
</wildcardResourcePatterns>
</component>
- <component name="DataSourceManagerImpl" />
<component name="DependenciesAnalyzeManager">
<option name="myForwardDirection" value="false" />
</component>
- <component name="DependencyValidationManager" />
+ <component name="DependencyValidationManager">
+ <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+ </component>
<component name="EclipseCompilerSettings">
<option name="DEBUGGING_INFO" value="true" />
<option name="GENERATE_NO_WARNINGS" value="true" />
@@ -54,14 +68,13 @@
<option name="MAXIMUM_HEAP_SIZE" value="128" />
</component>
<component name="EntryPointsManager">
- <entry_points />
+ <entry_points version="2.0" />
</component>
<component name="ExportToHTMLSettings">
<option name="PRINT_LINE_NUMBERS" value="false" />
<option name="OPEN_IN_BROWSER" value="false" />
<option name="OUTPUT_DIRECTORY" />
</component>
- <component name="GUI Designer component loader factory" />
<component name="IdProvider" IDEtalkID="1CF49F888FEE3EBA7B941733894FDE44" />
<component name="InspectionProjectProfileManager">
<option name="PROJECT_PROFILE" value="Project Default" />
@@ -71,26 +84,9 @@
<profile version="1.0" is_locked="false">
<option name="myName" value="Project Default" />
<option name="myLocal" value="false" />
- <used_levels>
- <error>
- <option name="myName" value="ERROR" />
- <option name="myVal" value="200" />
- </error>
- <warning>
- <option name="myName" value="WARNING" />
- <option name="myVal" value="100" />
- </warning>
- <information>
- <option name="myName" value="INFO" />
- <option name="myVal" value="200" />
- </information>
- <server>
- <option name="myName" value="SERVER PROBLEM" />
- <option name="myVal" value="100" />
- </server>
- </used_levels>
</profile>
</profiles>
+ <list size="0" />
</component>
<component name="JavacSettings">
<option name="DEBUGGING_INFO" value="true" />
@@ -251,6 +247,7 @@
</item>
</group>
</component>
+ <component name="ProjectFileVersion" converted="true" />
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/extensions/ant/ant.iml"
filepath="$PROJECT_DIR$/extensions/ant/ant.iml" />
@@ -262,9 +259,7 @@
<module fileurl="file://$PROJECT_DIR$/website/website.iml"
filepath="$PROJECT_DIR$/website/website.iml" />
</modules>
</component>
- <component name="ProjectRootManager" version="2" assert-keyword="true"
jdk-15="false" project-jdk-name="1.4" project-jdk-type="JavaSDK" />
- <component name="ProjectRunConfigurationManager" />
- <component name="RAILS_PROJECT_VIEW_PANE" />
+ <component name="ProjectRootManager" version="2" assert-keyword="true"
jdk-15="true" project-jdk-name="1.5" project-jdk-type="JavaSDK" />
<component name="RUBY_DOC_SETTINGS">
<RUBY_DOC NAME="DEFAULTS" VALUE="TRUE" />
<RUBY_DOC NAME="NUMBER" VALUE="0" />
@@ -276,8 +271,15 @@
<option name="GENERATE_IIOP_STUBS" value="false" />
<option name="ADDITIONAL_OPTIONS_STRING" value="" />
</component>
- <component name="StarteamVcsAdapter" />
- <component name="VssVcs" />
+ <component name="VcsDirectoryMappings">
+ <mapping directory="" vcs="svn" />
+ <mapping directory="$PROJECT_DIR$/core" vcs="svn" />
+ <mapping directory="$PROJECT_DIR$/extensions/ant" vcs="svn" />
+ <mapping directory="$PROJECT_DIR$/extensions/jmock" vcs="svn" />
+ <mapping directory="$PROJECT_DIR$/extensions/junit" vcs="svn" />
+ <mapping directory="$PROJECT_DIR$/lib" vcs="svn" />
+ <mapping directory="$PROJECT_DIR$/website" vcs="svn" />
+ </component>
<component name="com.intellij.jsf.UserDefinedFacesConfigs">
<option name="USER_DEFINED_CONFIGS">
<value>
@@ -285,12 +287,8 @@
</value>
</option>
</component>
- <component name="libraryTable" />
- <component name="uidesigner-configuration">
- <option name="INSTRUMENT_CLASSES" value="true" />
- <option name="COPY_FORMS_RUNTIME_TO_OUTPUT" value="true" />
- <option name="DEFAULT_LAYOUT_MANAGER" value="GridLayoutManager" />
- </component>
- <UsedPathMacros />
+ <UsedPathMacros>
+ <macro name="IDEA_HOME" />
+ </UsedPathMacros>
</project>
--- lib/lib.iml (revision 786)
+++ lib/lib.iml Mon Sep 03 15:27:56 PDT 2007
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
+<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/classes" />
<exclude-output />
@@ -9,7 +8,7 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="module-library">
+ <orderEntry type="module-library" exported="">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/extensions/velocity-dep-1.4.jar!/" />
@@ -18,11 +17,10 @@
<SOURCES />
</library>
</orderEntry>
- <orderEntry type="module" module-name="jbehave-core" />
- <orderEntry type="module-library">
+ <orderEntry type="module-library" exported="">
<library>
<CLASSES>
- <root url="jar://$MODULE_DIR$/extensions/antlr-2.7.6.jar!/" />
+ <root url="jar://$MODULE_DIR$/extensions/ant-1.7.0.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
--- extensions/jmock/jmock-extension.iml (revision 786)
+++ extensions/jmock/jmock-extension.iml Mon Sep 03 14:40:29 PDT 2007
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
+<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/classes" />
<exclude-output />
--- core/src/java/org/jbehave/core/behaviour/MethodVerifier.java
(revision 786)
+++ core/src/java/org/jbehave/core/behaviour/MethodVerifier.java Mon Sep
03 14:50:32 PDT 2007
@@ -5,11 +5,9 @@
class MethodVerifier implements MethodHandler {
- private final BehaviourVerifier verifier;
private final BehaviourListener listener;
- public MethodVerifier(BehaviourVerifier verifier, BehaviourListener
listener) {
- this.verifier = verifier;
+ public MethodVerifier(BehaviourListener listener) {
this.listener = listener;
}
@@ -18,6 +16,8 @@
}
public void handleMethod(BehaviourMethod behaviourMethod) {
- verifier.verifyBehaviour(behaviourMethod);
+ listener.before(behaviourMethod);
+ behaviourMethod.verifyTo(listener);
+ listener.after(behaviourMethod);
}
}
--- core/jbehave-core.iml (revision 786)
+++ core/jbehave-core.iml Mon Sep 03 15:24:44 PDT 2007
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
+<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/classes" />
<exclude-output />
@@ -11,6 +10,7 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="swing-extension" />
+ <orderEntry type="module" module-name="lib" />
<orderEntryProperties />
</component>
<component name="VcsManagerConfiguration">
--- extensions/ant/ant.iml (revision 786)
+++ extensions/ant/ant.iml Mon Sep 03 15:31:02 PDT 2007
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<module version="4" relativePaths="true" type="JAVA_MODULE">
- <component name="ModuleRootManager" />
+<module relativePaths="true" type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/classes" />
<exclude-output />
@@ -14,7 +13,7 @@
<orderEntry type="module-library">
<library>
<CLASSES>
- <root url="jar://$MODULE_DIR$/../../lib/extensions/ant-1.6.5.jar!/"
/>
+ <root url="jar://$MODULE_DIR$/../../lib/extensions/ant-1.7.0.jar!/"
/>
</CLASSES>
<JAVADOC />
<SOURCES />
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email