- Revision
- 782
- Author
- sirenian
- Date
- 2007-08-14 11:07:17 -0500 (Tue, 14 Aug 2007)
Log Message
[EK] Fixed stories and behaviours in headless mode.
Modified Paths
- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/givens/HellboundIsRunning.java
- trunk/extensions/swing/src/java/org/jbehave/threaded/swing/HeadlessChecker.java
Diff
Modified: trunk/examples/hellbound/src/stories/com/sirenian/hellbound/givens/HellboundIsRunning.java (781 => 782)
--- trunk/examples/hellbound/src/stories/com/sirenian/hellbound/givens/HellboundIsRunning.java 2007-08-14 07:36:24 UTC (rev 781) +++ trunk/examples/hellbound/src/stories/com/sirenian/hellbound/givens/HellboundIsRunning.java 2007-08-14 16:07:17 UTC (rev 782) @@ -5,6 +5,7 @@ import org.jbehave.core.story.domain.CleansUpWorld; import org.jbehave.core.story.domain.World; import org.jbehave.threaded.swing.DefaultWindowWrapper; +import org.jbehave.threaded.swing.HeadlessChecker; import com.sirenian.hellbound.Hellbound; import com.sirenian.hellbound.engine.EngineQueue; @@ -52,7 +53,9 @@ public void cleanUp(World world) { Logger.debug(this, "tidyUp Given"); - Hellbound hellbound = (Hellbound) world.get(WorldKey.HELLBOUND); - hellbound.stopHellbound(); + if (!new HeadlessChecker().isHeadless()) { + Hellbound hellbound = (Hellbound) world.get(WorldKey.HELLBOUND); + hellbound.stopHellbound(); + } } }
Modified: trunk/extensions/swing/src/java/org/jbehave/threaded/swing/HeadlessChecker.java (781 => 782)
--- trunk/extensions/swing/src/java/org/jbehave/threaded/swing/HeadlessChecker.java 2007-08-14 07:36:24 UTC (rev 781) +++ trunk/extensions/swing/src/java/org/jbehave/threaded/swing/HeadlessChecker.java 2007-08-14 16:07:17 UTC (rev 782) @@ -4,10 +4,14 @@ public class HeadlessChecker { - public void check() { - if ("true".equals(System.getProperty("java.awt.headless"))) { + public void check() throws PendingException { + if (isHeadless()) { throw new PendingException("Cannot verify behaviour when performing in headless mode."); } } + public boolean isHeadless() { + return "true".equals(System.getProperty("java.awt.headless")); + } + }
To unsubscribe from this list please visit:
