[jbehave-scm] [707] trunk/core/src/java/org/jbehave/core/mock: [EK] TimeoutException no longer dependent on extensions; SwingBehaviourException deleted as no longer used by anything.

2007-03-22 Thread sirenian
Title:  [707] trunk/core/src/java/org/jbehave/core/mock: [EK] TimeoutException no longer dependent on extensions; SwingBehaviourException deleted as no longer used by anything.







Revision 707
Author sirenian
Date 2007-03-22 08:34:12 -0500 (Thu, 22 Mar 2007)


Log Message
[EK] TimeoutException no longer dependent on extensions; SwingBehaviourException deleted as no longer used by anything.
Fixed recursive bug with UsingMatchers.either().
Added this story isn't functional javadoc to UserWithdrawsCash.

Modified Paths

trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java
trunk/core/src/java/org/jbehave/core/mock/UsingMatchers.java
trunk/core/src/java/org/jbehave/core/threaded/TimeoutException.java
trunk/examples/atm/src/stories/example/atm/stories/UserWithdrawsCash.java
trunk/examples/hellbound/src/stories/com/sirenian/hellbound/events/HellboundEvent.java
trunk/extensions/swing/src/java/org/jbehave/threaded/swing/ComponentFinderException.java


Removed Paths

trunk/extensions/swing/src/java/org/jbehave/threaded/swing/SwingBehaviourException.java




Diff

Modified: trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java (706 => 707)

--- trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java	2007-03-21 13:55:36 UTC (rev 706)
+++ trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java	2007-03-22 13:34:12 UTC (rev 707)
@@ -73,4 +73,11 @@
 // expected
 }
 }
+
+public void shouldProvideMatchersForOneOrAnotherCondition() throws Exception {
+UsingMatchers m = new UsingMatchers() {};
+
+Ensure.that(true, m.or(m.eq(true), m.eq(false)));
+Ensure.that(false, m.either(m.eq(true), m.eq(false)));
+}
 }


Modified: trunk/core/src/java/org/jbehave/core/mock/UsingMatchers.java (706 => 707)

--- trunk/core/src/java/org/jbehave/core/mock/UsingMatchers.java	2007-03-21 13:55:36 UTC (rev 706)
+++ trunk/core/src/java/org/jbehave/core/mock/UsingMatchers.java	2007-03-22 13:34:12 UTC (rev 707)
@@ -140,6 +140,10 @@
 	}
 	};
 	}
+
+public CustomMatcher nothing() {
+return isNull();
+}
 
 	public CustomMatcher a(final Class type) {
 	return isA(type);
@@ -198,7 +202,7 @@
 	}
 
 	public CustomMatcher either(final Matcher a, final Matcher b) {
-	return either(a, b);
+	return or(a, b);
 	}
 
 	public CustomMatcher not(final Matcher c) {


Modified: trunk/core/src/java/org/jbehave/core/threaded/TimeoutException.java (706 => 707)

--- trunk/core/src/java/org/jbehave/core/threaded/TimeoutException.java	2007-03-21 13:55:36 UTC (rev 706)
+++ trunk/core/src/java/org/jbehave/core/threaded/TimeoutException.java	2007-03-22 13:34:12 UTC (rev 707)
@@ -1,9 +1,7 @@
 package org.jbehave.core.threaded;
 
-import org.jbehave.threaded.swing.SwingBehaviourException;
+public class TimeoutException extends Exception {
 
-public class TimeoutException extends SwingBehaviourException {
-
-	private static final long serialVersionUID = 5776693901561603819L;
-
+private static final long serialVersionUID = 2L;
+
 }


Modified: trunk/examples/atm/src/stories/example/atm/stories/UserWithdrawsCash.java (706 => 707)

--- trunk/examples/atm/src/stories/example/atm/stories/UserWithdrawsCash.java	2007-03-21 13:55:36 UTC (rev 706)
+++ trunk/examples/atm/src/stories/example/atm/stories/UserWithdrawsCash.java	2007-03-22 13:34:12 UTC (rev 707)
@@ -17,6 +17,10 @@
 import example.atm.scenarios.OverdrawnWithoutPermission;
 
 /**
+ * This story is not functional. It's a good example to use with the
+ * StoryPrinter. If you want a functional story, look at the
+ * Hellbound examples instead.
+ * 
  * @author a href="" PROTECTED]Dan North /a
  */
 public class UserWithdrawsCash extends ScenarioDrivenStory {


Modified: trunk/examples/hellbound/src/stories/com/sirenian/hellbound/events/HellboundEvent.java (706 => 707)

--- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/events/HellboundEvent.java	2007-03-21 13:55:36 UTC (rev 706)
+++ trunk/examples/hellbound/src/stories/com/sirenian/hellbound/events/HellboundEvent.java	2007-03-22 13:34:12 UTC (rev 707)
@@ -2,7 +2,8 @@
 
 import org.jbehave.core.minimock.story.domain.EventUsingMiniMock;
 import org.jbehave.core.story.domain.World;
-import org.jbehave.threaded.swing.SwingBehaviourException;
+import org.jbehave.core.threaded.TimeoutException;
+import org.jbehave.threaded.swing.ComponentFinderException;
 import org.jbehave.threaded.swing.WindowWrapper;
 
 import com.sirenian.hellbound.stories.util.Idler;
@@ -29,25 +30,27 @@
 		WindowWrapper wrapper = (WindowWrapper) world.get(WorldKey.WINDOW_WRAPPER, null);
 	try {
 			wrapper.clickButton(buttonName);
-	} catch (SwingBehaviourException e) {
+	} catch (ComponentFinderException e) {
 	throw new RuntimeException(e);
-	}
+	} catch (TimeoutException e) {
+	throw new RuntimeException(e);
+}
 	}
 	
 	protected void pressKey(int keycode, World world) {
 		

[jbehave-dev] [jira] Closed: (JBEHAVE-81) Scenario steps should throw Exception in their signature.

2007-03-22 Thread Elizabeth Keogh (JIRA)

 [ 
http://jira.codehaus.org/browse/JBEHAVE-81?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Elizabeth Keogh closed JBEHAVE-81.
--

Resolution: Fixed

Scenario steps throw Exception in their main perform-method.

They do _not_ throw Exception in their cleanUp. This is because cleanUp happens 
in a finally {} clause, and you have to decide what you want to do with any 
exception you throw.

 Scenario steps should throw Exception in their signature.
 -

 Key: JBEHAVE-81
 URL: http://jira.codehaus.org/browse/JBEHAVE-81
 Project: JBehave
  Issue Type: Improvement
Affects Versions: 1.0
Reporter: Elizabeth Keogh
 Fix For: 1.1


 For the same reason that should... methods should be able to throw an 
 exception, so should ScenarioSteps. This prevents me having to wrap code that 
 shouldn't be throwing exceptions anyway.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



-
To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email



[jbehave-scm] [708] trunk/core/src/java/org/jbehave/core/mock: [EK] Added some missing UserMatchersBehaviours.

2007-03-22 Thread sirenian
Title:  [708] trunk/core/src/java/org/jbehave/core/mock: [EK] Added some missing UserMatchersBehaviours.







Revision 708
Author sirenian
Date 2007-03-22 09:06:33 -0500 (Thu, 22 Mar 2007)


Log Message
[EK] Added some missing UserMatchersBehaviours. And gained a better understanding of how anything() ( and therefore nothing() ) should work as a result.

Modified Paths

trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java
trunk/core/src/java/org/jbehave/core/mock/UsingMatchers.java




Diff

Modified: trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java (707 => 708)

--- trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java	2007-03-22 13:34:12 UTC (rev 707)
+++ trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java	2007-03-22 14:06:33 UTC (rev 708)
@@ -43,12 +43,45 @@
 Ensure.that(true, m.eq(true), message);
 }
 
-public void shouldProvideMatcherToCheckForNull() {
+public void shouldProvideMatchersToCheckForNull() {
 UsingMatchers m = new UsingMatchers() {};
 Ensure.that(null, m.isNull());
+Ensure.that(new Object(), m.not(m.isNull()));
 Ensure.that(new Object(), m.isNotNull());
+Ensure.that(null, m.not(m.isNotNull()));
 }
+
+public void shouldProvideMatchersToCheckForAnything() {
+UsingMatchers m = new UsingMatchers() {};
+Ensure.that(null, m.not(m.nothing()));
+Ensure.that(new Object(), m.not(m.nothing()));
+Ensure.that(new Object(), m.anything());
+Ensure.that(null, m.anything());
+}
+
+public void shouldProvideCommonStringMatchers() {
+UsingMatchers m = new UsingMatchers() {};
+
+Ensure.that(octopus, m.contains(top));
+Ensure.that(octopus, m.not(m.contains(eight)));
+Ensure.that(octopus, m.startsWith(octo));
+Ensure.that(octopus, m.not(m.startsWith(eight)));
+Ensure.that(octopus, m.endsWith(pus));
+Ensure.that(octopus, m.not(m.endsWith(eight)));
+}
 
+public void shouldProvideInstanceMatchers() {
+UsingMatchers m = new UsingMatchers() {};
+
+String a = a;
+String b = b;
+
+Ensure.that(a, m.is(a));
+Ensure.that(a, m.not(m.is(b)));
+Ensure.that(a, m.sameInstanceAs(a));
+Ensure.that(a, m.not(m.sameInstanceAs(b)));
+}
+
 public void shouldCatchAndReturnAThrownException() throws Exception {
 UsingMatchers m = new UsingMatchers() {};
 


Modified: trunk/core/src/java/org/jbehave/core/mock/UsingMatchers.java (707 => 708)

--- trunk/core/src/java/org/jbehave/core/mock/UsingMatchers.java	2007-03-22 13:34:12 UTC (rev 707)
+++ trunk/core/src/java/org/jbehave/core/mock/UsingMatchers.java	2007-03-22 14:06:33 UTC (rev 708)
@@ -142,7 +142,11 @@
 	}
 
 public CustomMatcher nothing() {
-return isNull();
+return new CustomMatcher(nothing) {
+public boolean matches(Object arg) {
+return false;
+}
+};
 }
 
 	public CustomMatcher a(final Class type) {










To unsubscribe from this list please visit:


http://xircles.codehaus.org/manage_email



[jbehave-scm] [709] trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java: [EK] And a couple more missing behaviours.

2007-03-22 Thread sirenian
Title:  [709] trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java: [EK] And a couple more missing behaviours.







Revision 709
Author sirenian
Date 2007-03-22 09:09:30 -0500 (Thu, 22 Mar 2007)


Log Message
[EK] And a couple more missing behaviours.

Modified Paths

trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java




Diff

Modified: trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java (708 => 709)

--- trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java	2007-03-22 14:06:33 UTC (rev 708)
+++ trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java	2007-03-22 14:09:30 UTC (rev 709)
@@ -107,10 +107,16 @@
 }
 }
 
-public void shouldProvideMatchersForOneOrAnotherCondition() throws Exception {
+public void shouldProvideConditionalMatchers() throws Exception {
 UsingMatchers m = new UsingMatchers() {};
 
-Ensure.that(true, m.or(m.eq(true), m.eq(false)));
-Ensure.that(false, m.either(m.eq(true), m.eq(false)));
+String horse = horse;
+String cow = cow;
+
+Ensure.that(horse, m.or(m.eq(horse), m.eq(cow)));
+Ensure.that(cow, m.either(m.eq(horse), m.eq(cow)));
+
+Ensure.that(horse, m.and(m.eq(horse), m.contains(ors)));
+Ensure.that(cow, m.both(m.eq(cow), m.endsWith(ow)));
 }
 }










To unsubscribe from this list please visit:


http://xircles.codehaus.org/manage_email



Re: [jbehave-dev] [jira] Created: (JBEHAVE-82) Behaviour plugin produces multiple launches for the same behaviour.

2007-03-22 Thread Dan North

What's wrong with multiple lunches?

Oh, /launches/!

Elizabeth Keogh (JIRA) wrote:

Behaviour plugin produces multiple launches for the same behaviour.
---

 Key: JBEHAVE-82
 URL: http://jira.codehaus.org/browse/JBEHAVE-82
 Project: JBehave
  Issue Type: Bug
  Components: Eclipse plugin
Affects Versions: 1.0
Reporter: Elizabeth Keogh
 Fix For: 1.1




  




Re: [jbehave-dev] [jira] Closed: (JBEHAVE-81) Scenario steps should throw Exception in their signature.

2007-03-22 Thread Dan North
Anything used as keys should have the same caveats as usual map keys, 
i.e. they should be immutable and their hashCode should play nice with 
their equals.


Cheers,
Dan

Elizabeth Keogh (JIRA) wrote:

 [ 
http://jira.codehaus.org/browse/JBEHAVE-81?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Elizabeth Keogh closed JBEHAVE-81.
--

Resolution: Fixed

Scenario steps throw Exception in their main perform-method.

They do _not_ throw Exception in their cleanUp. This is because cleanUp happens 
in a finally {} clause, and you have to decide what you want to do with any 
exception you throw.

  

Scenario steps should throw Exception in their signature.
-

Key: JBEHAVE-81
URL: http://jira.codehaus.org/browse/JBEHAVE-81
Project: JBehave
 Issue Type: Improvement
   Affects Versions: 1.0
   Reporter: Elizabeth Keogh
Fix For: 1.1


For the same reason that should... methods should be able to throw an 
exception, so should ScenarioSteps. This prevents me having to wrap code that 
shouldn't be throwing exceptions anyway.



  




[jbehave-scm] [710] trunk/core/src/behaviour/org/jbehave/core: [EK] Last matcher behaviours, added World key caveat to javadocs (happy Dan?)

2007-03-22 Thread sirenian
Title:  [710] trunk/core/src/behaviour/org/jbehave/core: [EK] Last matcher behaviours, added World key caveat to javadocs (happy Dan?)







Revision 710
Author sirenian
Date 2007-03-22 09:58:24 -0500 (Thu, 22 Mar 2007)


Log Message
[EK] Last matcher behaviours, added World key caveat to javadocs (happy Dan?)

Modified Paths

trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java
trunk/core/src/java/org/jbehave/core/story/domain/World.java




Diff

Modified: trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java (709 => 710)

--- trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java	2007-03-22 14:09:30 UTC (rev 709)
+++ trunk/core/src/behaviour/org/jbehave/core/UsingMatchersBehaviour.java	2007-03-22 14:58:24 UTC (rev 710)
@@ -9,8 +9,7 @@
 throw new NumberFormatException();
 }
 };
-
-
+
 Block EMPTY_BLOCK = new Block() {
 public void run() throws Exception {}
 };
@@ -89,14 +88,14 @@
 Ensure.that(exception, m.isNotNull());
 }
 
-public void shouldReturnNullIfNoExceptionThrown() throws Exception {
+public void shouldCatchAndReturnNullIfNoExceptionThrown() throws Exception {
 UsingMatchers m = new UsingMatchers() {};
 
 Exception exception = m.runAndCatch(IllegalArgumentException.class, EMPTY_BLOCK);
 Ensure.that(exception, m.isNull());
 }
 
-public void shouldPropagateExceptionOfAnUnexpectedType() throws Exception {
+public void shouldCatchAndRethrowExceptionOfAnUnexpectedType() throws Exception {
 UsingMatchers m = new UsingMatchers() {};
 
 try {


Modified: trunk/core/src/java/org/jbehave/core/story/domain/World.java (709 => 710)

--- trunk/core/src/java/org/jbehave/core/story/domain/World.java	2007-03-22 14:09:30 UTC (rev 709)
+++ trunk/core/src/java/org/jbehave/core/story/domain/World.java	2007-03-22 14:58:24 UTC (rev 710)
@@ -18,6 +18,10 @@
  * The methods on this interface are a legacy of JBehave 1.0.
  * We might remove them from the interface at some point.
  * 
+ * World keys should work as HashMap keys, ie: they should
+ * be immutable and their hashCode() should play nice with their
+ * equals().
+ * 
  * @see HashMapWorld, CustomWorld, Given, CleansUpWorld
  */
 public interface World {










To unsubscribe from this list please visit:


http://xircles.codehaus.org/manage_email