- Revision
- 794
- Author
- wolfdancer
- Date
- 2007-09-06 23:56:15 -0500 (Thu, 06 Sep 2007)
Log Message
removed the unused field behaviour verifier
Modified Paths
- trunk/core/jbehave-core.iml
- trunk/core/src/behaviour/org/jbehave/core/behaviour/BehaviourClassBehaviour.java
- trunk/core/src/java/org/jbehave/core/BehaviourRunner.java
- trunk/core/src/java/org/jbehave/core/behaviour/BehaviourClass.java
- trunk/core/src/java/org/jbehave/core/behaviour/MethodVerifier.java
- trunk/extensions/ant/ant.iml
- trunk/extensions/jmock/jmock-extension.iml
- trunk/extensions/junit/junit-extension.iml
- trunk/extensions/swing/swing-extension.iml
- trunk/jbehave.ipr
- trunk/lib/lib.iml
- trunk/website/website.iml
Diff
Modified: trunk/core/jbehave-core.iml (793 => 794)
--- trunk/core/jbehave-core.iml 2007-09-06 13:19:03 UTC (rev 793) +++ trunk/core/jbehave-core.iml 2007-09-07 04:56:15 UTC (rev 794) @@ -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="" /> <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">
Modified: trunk/core/src/behaviour/org/jbehave/core/behaviour/BehaviourClassBehaviour.java (793 => 794)
--- trunk/core/src/behaviour/org/jbehave/core/behaviour/BehaviourClassBehaviour.java 2007-09-06 13:19:03 UTC (rev 793) +++ trunk/core/src/behaviour/org/jbehave/core/behaviour/BehaviourClassBehaviour.java 2007-09-07 04:56:15 UTC (rev 794) @@ -24,8 +24,6 @@ */ public class BehaviourClassBehaviour extends UsingMiniMock { - private BehaviourVerifier nullVerifier = new BehaviourVerifier(BehaviourListener.NULL); - public static class ClassWithOneBehaviourMethod { public void shouldDoOneThing() {} } @@ -41,41 +39,26 @@ } }; } - - private Matcher isBehaviourMethodFor(final String name) { - return new Matcher() { - public boolean matches(Object arg) { - BehaviourMethod behaviourMethod = (BehaviourMethod)arg; - return behaviourMethod != null && behaviourMethod.method().getName().equals(name); - } - public String toString() { - return "behaviour method for " + name; - } - }; - } - + public void shouldVerifySingleBehaviourMethod() throws Exception { // given Mock listener = mock(BehaviourListener.class); - final Behaviour[] capturedBehaviour = new Behaviour[1]; // the behaviour - - BehaviourVerifier verifier = new BehaviourVerifier(null) { // hand-rolled mock for concrete class - public void verifyBehaviour(Behaviour behaviour) { - capturedBehaviour[0] = behaviour; - } - }; - Behaviour behaviour = new BehaviourClass(ClassWithOneBehaviourMethod.class, verifier); + listener.expects("before").once(); + listener.expects("after").once(); + listener.expects("gotResult").once(); + BehaviourClass behaviour = new BehaviourClass(ClassWithOneBehaviourMethod.class); + // when behaviour.verifyTo((BehaviourListener) listener); // then - ensureThat(capturedBehaviour[0], isBehaviourMethodFor("shouldDoOneThing")); + listener.verify(); } public void shouldCountSingleBehaviourMethod() throws Exception { // given - Behaviour behaviour = new BehaviourClass(ClassWithOneBehaviourMethod.class, nullVerifier); + Behaviour behaviour = new BehaviourClass(ClassWithOneBehaviourMethod.class); // then ensureThat(behaviour.countBehaviours(), eq(1)); @@ -90,7 +73,7 @@ // given Mock listener = mock(BehaviourListener.class); Behaviour behaviour = new BehaviourClass( - ClassWithTwoBehaviourMethods.class, new BehaviourVerifier((BehaviourListener) listener)); + ClassWithTwoBehaviourMethods.class); // expect listener.expects("gotResult").with(successfulResultFromMethodCalled("shouldDoOneThing")); @@ -105,14 +88,14 @@ public void shouldCountMultipleBehaviourMethods() throws Exception { // given - Behaviour behaviour = new BehaviourClass(ClassWithTwoBehaviourMethods.class, nullVerifier); + Behaviour behaviour = new BehaviourClass(ClassWithTwoBehaviourMethods.class); // then ensureThat(behaviour.countBehaviours(), eq(2)); } public void shouldOnlyRunTheOnesSpecified() { - BehaviourClass behaviour = new BehaviourClass(ClassWithTwoBehaviourMethods.class, "shouldDoOneThing", nullVerifier); + BehaviourClass behaviour = new BehaviourClass(ClassWithTwoBehaviourMethods.class, "shouldDoOneThing"); ensureThat(behaviour.countBehaviours(), eq(1)); } @@ -132,7 +115,7 @@ // given Mock listener = mock(BehaviourListener.class); Behaviour behaviour = new BehaviourClass( - ClassWithNestedClasses.class, new BehaviourVerifier((BehaviourListener) listener)); + ClassWithNestedClasses.class); // expect listener.expects("gotResult").with(successfulResultFromMethodCalled("shouldDoSomething1")); @@ -147,7 +130,7 @@ public void shouldCountNestedBehaviourClasses() throws Exception { // given - Behaviour behaviour = new BehaviourClass(ClassWithNestedClasses.class, nullVerifier); + Behaviour behaviour = new BehaviourClass(ClassWithNestedClasses.class); // when int count = behaviour.countBehaviours(); @@ -166,7 +149,7 @@ // given Mock listener = mock(BehaviourListener.class); Behaviour behaviour = new BehaviourClass( - ClassWithDeeplyNestedClasses.class, new BehaviourVerifier((BehaviourListener) listener)); + ClassWithDeeplyNestedClasses.class); // expect listener.expects("gotResult").with(successfulResultFromMethodCalled("shouldDoSomething1")); @@ -181,7 +164,7 @@ public void shouldCountDeeplyNestedBehaviourMethods() throws Exception { // given - Behaviour behaviour = new BehaviourClass(ClassWithDeeplyNestedClasses.class, nullVerifier); + Behaviour behaviour = new BehaviourClass(ClassWithDeeplyNestedClasses.class); // when int count = behaviour.countBehaviours(); @@ -197,7 +180,7 @@ public void shouldIgnorePublicMethodsThatDontStartWithShould() throws Exception { // given Mock listener = mock(BehaviourListener.class); - Behaviour behaviour = new BehaviourClass(HasNoBehaviourMethods.class, nullVerifier); + Behaviour behaviour = new BehaviourClass(HasNoBehaviourMethods.class); // expect listener.expects("gotResult").never(); @@ -216,7 +199,7 @@ public void shouldIgnoreNonPublicMethodsThatStartWithShould() throws Exception { // given Mock listener = mock(BehaviourListener.class); - Behaviour behaviour = new BehaviourClass(HasNonPublicBehaviourMethod.class, nullVerifier); + Behaviour behaviour = new BehaviourClass(HasNonPublicBehaviourMethod.class); // expect listener.expects("gotResult").never(); @@ -228,7 +211,7 @@ verifyMocks(); } - private static List instances; + private static List<CapturesClassInstance> instances; public static class CapturesClassInstance { public void shouldCaptureInstance() { @@ -241,9 +224,9 @@ public void shouldCreateNewInstanceForEachBehaviourMethod() throws Exception { // given - instances = new ArrayList(); + instances = new ArrayList<CapturesClassInstance>(); BehaviourListener nullListener = (BehaviourListener) stub(BehaviourListener.class); - Behaviour behaviour = new BehaviourClass(CapturesClassInstance.class, nullVerifier); + Behaviour behaviour = new BehaviourClass(CapturesClassInstance.class); // when behaviour.verifyTo(nullListener);
Modified: trunk/core/src/java/org/jbehave/core/BehaviourRunner.java (793 => 794)
--- trunk/core/src/java/org/jbehave/core/BehaviourRunner.java 2007-09-06 13:19:03 UTC (rev 793) +++ trunk/core/src/java/org/jbehave/core/BehaviourRunner.java 2007-09-07 04:56:15 UTC (rev 794) @@ -74,7 +74,7 @@ public void verifyBehaviour(Class classToVerify, String methodName) { BehaviourListener listener = new PlainTextListener(writer, new Timer()); BehaviourVerifier verifier = new BehaviourVerifier(listener); - verifier.verifyBehaviour(new BehaviourClass(classToVerify, methodName, verifier)); + verifier.verifyBehaviour(new BehaviourClass(classToVerify, methodName)); listener.printReport(); succeeded = succeeded && !listener.hasBehaviourFailures(); }
Modified: trunk/core/src/java/org/jbehave/core/behaviour/BehaviourClass.java (793 => 794)
--- trunk/core/src/java/org/jbehave/core/behaviour/BehaviourClass.java 2007-09-06 13:19:03 UTC (rev 793) +++ trunk/core/src/java/org/jbehave/core/behaviour/BehaviourClass.java 2007-09-07 04:56:15 UTC (rev 794) @@ -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() { @@ -75,36 +69,36 @@ } public BehaviourMethod[] getBehaviourMethods(){ - Set set = new HashSet(); + Set<BehaviourMethod> set = new HashSet<BehaviourMethod>(); 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()]); + } + return 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(); + Set<Method> set = new HashSet<Method>(); Method[] classMethods = classToVerify.getMethods(); for (int i = 0; i < classMethods.length; i++) { Method method = classMethods[i]; if ( methodFilter.matches(method)) { set.add(method); } - } - return (Method[]) set.toArray(new Method[set.size()]); + } + return 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; } - } + } }
Modified: trunk/core/src/java/org/jbehave/core/behaviour/MethodVerifier.java (793 => 794)
--- trunk/core/src/java/org/jbehave/core/behaviour/MethodVerifier.java 2007-09-06 13:19:03 UTC (rev 793) +++ trunk/core/src/java/org/jbehave/core/behaviour/MethodVerifier.java 2007-09-07 04:56:15 UTC (rev 794) @@ -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); } }
Modified: trunk/extensions/ant/ant.iml (793 => 794)
--- trunk/extensions/ant/ant.iml 2007-09-06 13:19:03 UTC (rev 793) +++ trunk/extensions/ant/ant.iml 2007-09-07 04:56:15 UTC (rev 794) @@ -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="" /> <exclude-output /> @@ -14,7 +13,7 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="" /> + <root url="" /> </CLASSES> <JAVADOC /> <SOURCES />
Modified: trunk/extensions/jmock/jmock-extension.iml (793 => 794)
--- trunk/extensions/jmock/jmock-extension.iml 2007-09-06 13:19:03 UTC (rev 793) +++ trunk/extensions/jmock/jmock-extension.iml 2007-09-07 04:56:15 UTC (rev 794) @@ -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="" /> <exclude-output />
Modified: trunk/extensions/junit/junit-extension.iml (793 => 794)
--- trunk/extensions/junit/junit-extension.iml 2007-09-06 13:19:03 UTC (rev 793) +++ trunk/extensions/junit/junit-extension.iml 2007-09-07 04:56:15 UTC (rev 794) @@ -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="" /> <exclude-output />
Modified: trunk/extensions/swing/swing-extension.iml (793 => 794)
--- trunk/extensions/swing/swing-extension.iml 2007-09-06 13:19:03 UTC (rev 793) +++ trunk/extensions/swing/swing-extension.iml 2007-09-07 04:56:15 UTC (rev 794) @@ -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="" /> <exclude-output />
Modified: trunk/jbehave.ipr (793 => 794)
--- trunk/jbehave.ipr 2007-09-06 13:19:03 UTC (rev 793) +++ trunk/jbehave.ipr 2007-09-07 04:56:15 UTC (rev 794) @@ -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>
Modified: trunk/lib/lib.iml (793 => 794)
--- trunk/lib/lib.iml 2007-09-06 13:19:03 UTC (rev 793) +++ trunk/lib/lib.iml 2007-09-07 04:56:15 UTC (rev 794) @@ -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="" /> <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="" /> @@ -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="" /> + <root url="" /> </CLASSES> <JAVADOC /> <SOURCES />
Modified: trunk/website/website.iml (793 => 794)
--- trunk/website/website.iml 2007-09-06 13:19:03 UTC (rev 793) +++ trunk/website/website.iml 2007-09-07 04:56:15 UTC (rev 794) @@ -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="" /> <exclude-output />
To unsubscribe from this list please visit:
