commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r730783 - in /commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml: ./ env/jsp/ invoke/ io/ model/
Date Fri, 02 Jan 2009 16:58:59 GMT
Author: sebb
Date: Fri Jan  2 08:58:59 2009
New Revision: 730783

URL: http://svn.apache.org/viewvc?rev=730783&view=rev
Log:
SCXML-91 (1) - Test cases should only catch Exception if that is part of the test

Modified:
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/EventDataTest.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/NamespacePrefixedXPathsTest.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/WildcardTest.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/WizardsTest.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jsp/RootContextTest.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/invoke/InvokeParamNameTest.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/StateSrcTest.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/CustomActionTest.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/DatamodelTest.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/HistoryTest.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/ParallelTest.java
    commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/StatelessModelTest.java

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/EventDataTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/EventDataTest.java?rev=730783&r1=730782&r2=730783&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/EventDataTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/EventDataTest.java Fri Jan  2 08:58:59 2009
@@ -76,96 +76,80 @@
     /**
      * Test the SCXML documents, usage of "_eventdata"
      */
-    public void testEventdata01Sample() {
+    public void testEventdata01Sample() throws Exception {
     	exec = SCXMLTestHelper.getExecutor(eventdata01);
         assertNotNull(exec);
-        try {
-            Set currentStates = exec.getCurrentStatus().getStates();
-            assertEquals(1, currentStates.size());
-            assertEquals("state1", ((State)currentStates.iterator().
-                next()).getId());
-            TriggerEvent te = new TriggerEvent("event.foo",
-                TriggerEvent.SIGNAL_EVENT, new Integer(3));
-            currentStates = SCXMLTestHelper.fireEvent(exec, te);
-            assertEquals(1, currentStates.size());
-            assertEquals("state3", ((State)currentStates.iterator().
-                next()).getId());
-            TriggerEvent[] evts = new TriggerEvent[] { te,
-                new TriggerEvent("event.bar", TriggerEvent.SIGNAL_EVENT,
-                new Integer(6))};
-            currentStates = SCXMLTestHelper.fireEvents(exec, evts);
-            assertEquals(1, currentStates.size());
-            assertEquals("state6", ((State)currentStates.iterator().
-                next()).getId());
-            te = new TriggerEvent("event.baz",
-                TriggerEvent.SIGNAL_EVENT, new Integer(7));
-            currentStates = SCXMLTestHelper.fireEvent(exec, te);
-            assertEquals(1, currentStates.size());
-            assertEquals("state7", ((State)currentStates.iterator().
-                next()).getId());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        Set currentStates = exec.getCurrentStatus().getStates();
+        assertEquals(1, currentStates.size());
+        assertEquals("state1", ((State)currentStates.iterator().
+            next()).getId());
+        TriggerEvent te = new TriggerEvent("event.foo",
+            TriggerEvent.SIGNAL_EVENT, new Integer(3));
+        currentStates = SCXMLTestHelper.fireEvent(exec, te);
+        assertEquals(1, currentStates.size());
+        assertEquals("state3", ((State)currentStates.iterator().
+            next()).getId());
+        TriggerEvent[] evts = new TriggerEvent[] { te,
+            new TriggerEvent("event.bar", TriggerEvent.SIGNAL_EVENT,
+            new Integer(6))};
+        currentStates = SCXMLTestHelper.fireEvents(exec, evts);
+        assertEquals(1, currentStates.size());
+        assertEquals("state6", ((State)currentStates.iterator().
+            next()).getId());
+        te = new TriggerEvent("event.baz",
+            TriggerEvent.SIGNAL_EVENT, new Integer(7));
+        currentStates = SCXMLTestHelper.fireEvent(exec, te);
+        assertEquals(1, currentStates.size());
+        assertEquals("state7", ((State)currentStates.iterator().
+            next()).getId());
     }
 
-    public void testEventdata02Sample() {
+    public void testEventdata02Sample() throws Exception {
     	exec = SCXMLTestHelper.getExecutor(eventdata02);
         assertNotNull(exec);
-        try {
-            Set currentStates = exec.getCurrentStatus().getStates();
-            assertEquals(1, currentStates.size());
-            assertEquals("state0", ((State)currentStates.iterator().
-                next()).getId());
-            TriggerEvent te1 = new TriggerEvent("connection.alerting",
-                TriggerEvent.SIGNAL_EVENT, "line2");
-            currentStates = SCXMLTestHelper.fireEvent(exec, te1);
-            assertEquals(1, currentStates.size());
-            assertEquals("state2", ((State)currentStates.iterator().
-                next()).getId());
-            TriggerEvent te2 = new TriggerEvent("connection.alerting",
-                TriggerEvent.SIGNAL_EVENT,
-                new ConnectionAlertingPayload(4));
-            currentStates = SCXMLTestHelper.fireEvent(exec, te2);
-            assertEquals(1, currentStates.size());
-            assertEquals("state4", ((State)currentStates.iterator().
-                next()).getId());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        Set currentStates = exec.getCurrentStatus().getStates();
+        assertEquals(1, currentStates.size());
+        assertEquals("state0", ((State)currentStates.iterator().
+            next()).getId());
+        TriggerEvent te1 = new TriggerEvent("connection.alerting",
+            TriggerEvent.SIGNAL_EVENT, "line2");
+        currentStates = SCXMLTestHelper.fireEvent(exec, te1);
+        assertEquals(1, currentStates.size());
+        assertEquals("state2", ((State)currentStates.iterator().
+            next()).getId());
+        TriggerEvent te2 = new TriggerEvent("connection.alerting",
+            TriggerEvent.SIGNAL_EVENT,
+            new ConnectionAlertingPayload(4));
+        currentStates = SCXMLTestHelper.fireEvent(exec, te2);
+        assertEquals(1, currentStates.size());
+        assertEquals("state4", ((State)currentStates.iterator().
+            next()).getId());
     }
 
-    public void testEventdata03Sample() {
+    public void testEventdata03Sample() throws Exception {
         exec = SCXMLTestHelper.getExecutor(eventdata03);
         assertNotNull(exec);
-        try {
-            Set currentStates = exec.getCurrentStatus().getStates();
-            assertEquals(1, currentStates.size());
-            assertEquals("ten", ((State)currentStates.iterator().
-                next()).getId());
-            TriggerEvent te = new TriggerEvent("event.foo",
-                TriggerEvent.SIGNAL_EVENT);
-            currentStates = SCXMLTestHelper.fireEvent(exec, te);
-            assertEquals(1, currentStates.size());
-            assertEquals("thirty", ((State)currentStates.iterator().
-                next()).getId());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        Set currentStates = exec.getCurrentStatus().getStates();
+        assertEquals(1, currentStates.size());
+        assertEquals("ten", ((State)currentStates.iterator().
+            next()).getId());
+        TriggerEvent te = new TriggerEvent("event.foo",
+            TriggerEvent.SIGNAL_EVENT);
+        currentStates = SCXMLTestHelper.fireEvent(exec, te);
+        assertEquals(1, currentStates.size());
+        assertEquals("thirty", ((State)currentStates.iterator().
+            next()).getId());
     }
 
-    public void testEventdata04Sample() throws InterruptedException {
+    public void testEventdata04Sample() throws Exception {
         SCXML scxml = SCXMLTestHelper.parse(eventdata04);
         Tracer trc = new Tracer();
-        try {
-            exec = new SCXMLExecutor(new JexlEvaluator(), null, trc);
-            exec.setEventdispatcher(new SimpleScheduler(exec));
-            exec.addListener(scxml, trc);
-            exec.setStateMachine(scxml);
-            exec.go();
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        exec = new SCXMLExecutor(new JexlEvaluator(), null, trc);
         assertNotNull(exec);
+        exec.setEventdispatcher(new SimpleScheduler(exec));
+        exec.addListener(scxml, trc);
+        exec.setStateMachine(scxml);
+        exec.go();
         Thread.sleep(200); // let the 100 delay lapse
     }
 

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/NamespacePrefixedXPathsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/NamespacePrefixedXPathsTest.java?rev=730783&r1=730782&r2=730783&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/NamespacePrefixedXPathsTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/NamespacePrefixedXPathsTest.java Fri Jan  2 08:58:59 2009
@@ -75,75 +75,67 @@
      * Test the XPath evaluation
      */
     // JEXL
-    public void testNamespacePrefixedXPathsJexl() {
+    public void testNamespacePrefixedXPathsJexl() throws Exception {
         runtest(exec01);
     }
 
     // EL
-    public void testNamespacePrefixedXPathsEL() {
+    public void testNamespacePrefixedXPathsEL() throws Exception {
         runtest(exec02);
     }
 
     // Same test, since same documents (different expression languages)
-    private void runtest(SCXMLExecutor exec) {
-
-        try {
-
-            // must be in state "ten" at the onset
-            Set currentStates = exec.getCurrentStatus().getStates();
-            assertEquals(1, currentStates.size());
-            assertEquals("ten", ((State)currentStates.iterator().
-                next()).getId());
-
-            // should move to "twenty"
-            currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
-            assertEquals(1, currentStates.size());
-            assertEquals("twenty", ((State)currentStates.iterator().
-                next()).getId());
-
-            // This is set while exiting "ten"
-            Double retval = (Double) exec.getRootContext().get("retval");
-            assertEquals(Double.valueOf("11"), retval);
-
-            // On to "thirty"
-            currentStates = SCXMLTestHelper.fireEvent(exec, "twenty.done");
-            assertEquals(1, currentStates.size());
-            assertEquals("thirty", ((State)currentStates.iterator().
-                next()).getId());
-            exec = SCXMLTestHelper.testExecutorSerializability(exec);
-
-            // Tests XPath on SCXML actions, set while exiting "twenty"
-            String retvalstr = (String) exec.getRootContext().get("retval");
-            assertEquals("Equal to 20", retvalstr);
-
-            // and so on ...
-            currentStates = SCXMLTestHelper.fireEvent(exec, "thirty.done");
-            assertEquals(1, currentStates.size());
-            assertEquals("forty", ((State)currentStates.iterator().
-                next()).getId());
-
-            currentStates = SCXMLTestHelper.fireEvent(exec, "forty.done");
-            assertEquals(1, currentStates.size());
-            assertEquals("fifty", ((State)currentStates.iterator().
-                next()).getId());
-
-            currentStates = SCXMLTestHelper.fireEvent(exec, "fifty.done");
-            assertEquals(1, currentStates.size());
-            assertEquals("sixty", ((State)currentStates.iterator().
-                next()).getId());
-
-            currentStates = SCXMLTestHelper.fireEvent(exec, "sixty.done");
-            assertEquals(1, currentStates.size());
-            assertEquals("seventy", ((State)currentStates.iterator().
-                next()).getId());
-
-            // done
-            assertTrue(exec.getCurrentStatus().isFinal());
-
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+    private void runtest(SCXMLExecutor exec) throws Exception {
+        // must be in state "ten" at the onset
+        Set currentStates = exec.getCurrentStatus().getStates();
+        assertEquals(1, currentStates.size());
+        assertEquals("ten", ((State)currentStates.iterator().
+            next()).getId());
+
+        // should move to "twenty"
+        currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+        assertEquals(1, currentStates.size());
+        assertEquals("twenty", ((State)currentStates.iterator().
+            next()).getId());
+
+        // This is set while exiting "ten"
+        Double retval = (Double) exec.getRootContext().get("retval");
+        assertEquals(Double.valueOf("11"), retval);
+
+        // On to "thirty"
+        currentStates = SCXMLTestHelper.fireEvent(exec, "twenty.done");
+        assertEquals(1, currentStates.size());
+        assertEquals("thirty", ((State)currentStates.iterator().
+            next()).getId());
+        exec = SCXMLTestHelper.testExecutorSerializability(exec);
+
+        // Tests XPath on SCXML actions, set while exiting "twenty"
+        String retvalstr = (String) exec.getRootContext().get("retval");
+        assertEquals("Equal to 20", retvalstr);
+
+        // and so on ...
+        currentStates = SCXMLTestHelper.fireEvent(exec, "thirty.done");
+        assertEquals(1, currentStates.size());
+        assertEquals("forty", ((State)currentStates.iterator().
+            next()).getId());
+
+        currentStates = SCXMLTestHelper.fireEvent(exec, "forty.done");
+        assertEquals(1, currentStates.size());
+        assertEquals("fifty", ((State)currentStates.iterator().
+            next()).getId());
+
+        currentStates = SCXMLTestHelper.fireEvent(exec, "fifty.done");
+        assertEquals(1, currentStates.size());
+        assertEquals("sixty", ((State)currentStates.iterator().
+            next()).getId());
+
+        currentStates = SCXMLTestHelper.fireEvent(exec, "sixty.done");
+        assertEquals(1, currentStates.size());
+        assertEquals("seventy", ((State)currentStates.iterator().
+            next()).getId());
 
+        // done
+        assertTrue(exec.getCurrentStatus().isFinal());
     }
 
     public static void main(String args[]) {

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java?rev=730783&r1=730782&r2=730783&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java Fri Jan  2 08:58:59 2009
@@ -101,34 +101,34 @@
     /**
      * Test the implementation
      */
-    public void testSCXMLExecutorMicrowave01JspSample() {
+    public void testSCXMLExecutorMicrowave01JspSample() throws Exception {
         exec = SCXMLTestHelper.getExecutor(microwave01jsp,
             new SimpleContext(), new ELEvaluator());
         assertNotNull(exec);
         checkMicrowave01Sample();
     }
 
-    public void testSCXMLExecutorMicrowave02JspSample() {
+    public void testSCXMLExecutorMicrowave02JspSample() throws Exception {
         exec = SCXMLTestHelper.getExecutor(microwave02jsp,
             new SimpleContext(), new ELEvaluator());
         assertNotNull(exec);
         checkMicrowave02Sample();
     }
 
-    public void testSCXMLExecutorMicrowave01JexlSample() {
+    public void testSCXMLExecutorMicrowave01JexlSample() throws Exception {
         exec = SCXMLTestHelper.getExecutor(microwave01jexl);
         assertNotNull(exec);
         checkMicrowave01Sample();
     }
 
-    public void testSCXMLExecutorMicrowave02JexlSample() {
+    public void testSCXMLExecutorMicrowave02JexlSample() throws Exception {
         exec = SCXMLTestHelper.getExecutor(microwave02jexl);
         assertNotNull(exec);
         checkMicrowave02Sample();
     }
 
     // Uses SCXMLParser (latest WD)
-    public void testSCXMLExecutorMicrowave03JexlSample() {
+    public void testSCXMLExecutorMicrowave03JexlSample() throws Exception {
         SCXML scxml = SCXMLTestHelper.parse(microwave03jexl);
         assertNotNull(scxml);
         exec = SCXMLTestHelper.getExecutor(scxml);
@@ -137,7 +137,7 @@
     }
 
     // Uses SCXMLParser (latest WD)
-    public void testSCXMLExecutorMicrowave04JexlSample() {
+    public void testSCXMLExecutorMicrowave04JexlSample() throws Exception {
         SCXML scxml = SCXMLTestHelper.parse(microwave04jexl);
         assertNotNull(scxml);
         exec = SCXMLTestHelper.getExecutor(scxml);
@@ -146,7 +146,7 @@
     }
 
     // Uses SCXMLParser (latest WD)
-    public void testSCXMLExecutorMicrowave05JexlSample() {
+    public void testSCXMLExecutorMicrowave05JexlSample() throws Exception {
         SCXML scxml = SCXMLTestHelper.parse(microwave05jexl);
         assertNotNull(scxml);
         exec = SCXMLTestHelper.getExecutor(scxml);
@@ -167,149 +167,117 @@
             next()).getId());
     }
 
-    public void testSCXMLExecutorTransitions01Sample() {
+    public void testSCXMLExecutorTransitions01Sample() throws Exception {
         exec = SCXMLTestHelper.getExecutor(transitions01);
         assertNotNull(exec);
-        try {
-            Set currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
-            assertEquals(1, currentStates.size());
-            assertEquals("twenty_one", ((State)currentStates.iterator().
-                next()).getId());
-            currentStates = SCXMLTestHelper.fireEvent(exec, "twenty_one.done");
-            assertEquals(1, currentStates.size());
-            assertEquals("twenty_two", ((State)currentStates.iterator().
-                next()).getId());
-            currentStates = SCXMLTestHelper.fireEvent(exec, "twenty_two.done");
-            assertEquals(3, exec.getCurrentStatus().getStates().size());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        Set currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+        assertEquals(1, currentStates.size());
+        assertEquals("twenty_one", ((State)currentStates.iterator().
+            next()).getId());
+        currentStates = SCXMLTestHelper.fireEvent(exec, "twenty_one.done");
+        assertEquals(1, currentStates.size());
+        assertEquals("twenty_two", ((State)currentStates.iterator().
+            next()).getId());
+        currentStates = SCXMLTestHelper.fireEvent(exec, "twenty_two.done");
+        assertEquals(3, exec.getCurrentStatus().getStates().size());
     }
 
-    public void testSCXMLExecutorTransitions02Sample() {
+    public void testSCXMLExecutorTransitions02Sample() throws Exception {
         exec = SCXMLTestHelper.getExecutor(transitions02);
         assertNotNull(exec);
-        try {
-            Set currentStates = SCXMLTestHelper.fireEvent(exec, "ten.stay");
-            assertEquals(1, currentStates.size());
-            assertEquals("ten", ((State)currentStates.iterator().
-                next()).getId());
-            exec = SCXMLTestHelper.testExecutorSerializability(exec);
-            currentStates = SCXMLTestHelper.fireEvent(exec, "ten.self");
-            assertEquals(1, currentStates.size());
-            assertEquals("ten", ((State)currentStates.iterator().
-                next()).getId());
-            currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
-            assertEquals(1, currentStates.size());
-            assertEquals("twenty", ((State)currentStates.iterator().
-                next()).getId());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        Set currentStates = SCXMLTestHelper.fireEvent(exec, "ten.stay");
+        assertEquals(1, currentStates.size());
+        assertEquals("ten", ((State)currentStates.iterator().
+            next()).getId());
+        exec = SCXMLTestHelper.testExecutorSerializability(exec);
+        currentStates = SCXMLTestHelper.fireEvent(exec, "ten.self");
+        assertEquals(1, currentStates.size());
+        assertEquals("ten", ((State)currentStates.iterator().
+            next()).getId());
+        currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+        assertEquals(1, currentStates.size());
+        assertEquals("twenty", ((State)currentStates.iterator().
+            next()).getId());
     }
 
-    public void testSCXMLExecutorTransitions03Sample() {
+    public void testSCXMLExecutorTransitions03Sample() throws Exception {
         exec = SCXMLTestHelper.getExecutor(transitions03);
         assertNotNull(exec);
-        try {
-            Set currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
-            assertEquals(3, currentStates.size());
-            Set expected = new HashSet();
-            expected.add("twenty_one_2");
-            expected.add("twenty_two_2");
-            expected.add("twenty_three_2");
-            for (Iterator i = currentStates.iterator(); i.hasNext(); ) {
-                TransitionTarget tt = (TransitionTarget) i.next();
-                if (!expected.remove(tt.getId())) {
-                    fail("'" + tt.getId()
-                        + "' is not an expected current state ID");
-                }
+        Set currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+        assertEquals(3, currentStates.size());
+        Set expected = new HashSet();
+        expected.add("twenty_one_2");
+        expected.add("twenty_two_2");
+        expected.add("twenty_three_2");
+        for (Iterator i = currentStates.iterator(); i.hasNext(); ) {
+            TransitionTarget tt = (TransitionTarget) i.next();
+            if (!expected.remove(tt.getId())) {
+                fail("'" + tt.getId()
+                    + "' is not an expected current state ID");
             }
-        } catch (Exception e) {
-            fail(e.getMessage());
         }
     }
 
     // Uses SCXMLParser (latest WD)
-    public void testSCXMLExecutorTransitions04Sample() {
+    public void testSCXMLExecutorTransitions04Sample() throws Exception {
         SCXML scxml = SCXMLTestHelper.parse(transitions04);
         assertNotNull(scxml);
         exec = SCXMLTestHelper.getExecutor(scxml);
         assertNotNull(exec);
-        try {
-            Set currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
-            assertEquals(3, currentStates.size());
-            Set expected = new HashSet();
-            expected.add("twenty_one_1");
-            expected.add("twenty_two_1");
-            expected.add("twenty_three_1");
-            for (Iterator i = currentStates.iterator(); i.hasNext(); ) {
-                TransitionTarget tt = (TransitionTarget) i.next();
-                if (!expected.remove(tt.getId())) {
-                    fail("'" + tt.getId()
-                        + "' is not an expected current state ID");
-                }
+        Set currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+        assertEquals(3, currentStates.size());
+        Set expected = new HashSet();
+        expected.add("twenty_one_1");
+        expected.add("twenty_two_1");
+        expected.add("twenty_three_1");
+        for (Iterator i = currentStates.iterator(); i.hasNext(); ) {
+            TransitionTarget tt = (TransitionTarget) i.next();
+            if (!expected.remove(tt.getId())) {
+                fail("'" + tt.getId()
+                    + "' is not an expected current state ID");
             }
-            currentStates = SCXMLTestHelper.fireEvent(exec, "bar");
-            assertEquals(1, currentStates.size());
-            assertEquals("thirty", ((State)currentStates.iterator().
-                next()).getId());
-        } catch (Exception e) {
-            fail(e.getMessage());
         }
+        currentStates = SCXMLTestHelper.fireEvent(exec, "bar");
+        assertEquals(1, currentStates.size());
+        assertEquals("thirty", ((State)currentStates.iterator().
+            next()).getId());
     }
 
-    public void testSend01Sample() {
+    public void testSend01Sample() throws Exception {
         exec = SCXMLTestHelper.getExecutor(send01);
         assertNotNull(exec);
-        try {
-            Set currentStates = exec.getCurrentStatus().getStates();
-            assertEquals(1, currentStates.size());
-            assertEquals("ten", ((State)currentStates.iterator().
-                next()).getId());
-            currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
-            assertEquals(1, currentStates.size());
-            assertEquals("twenty", ((State)currentStates.iterator().
-                next()).getId());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        Set currentStates = exec.getCurrentStatus().getStates();
+        assertEquals(1, currentStates.size());
+        assertEquals("ten", ((State)currentStates.iterator().
+            next()).getId());
+        currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+        assertEquals(1, currentStates.size());
+        assertEquals("twenty", ((State)currentStates.iterator().
+            next()).getId());
     }
 
-    public void testSend02TargettypeSCXMLSample() {
+    public void testSend02TargettypeSCXMLSample() throws Exception {
         exec = SCXMLTestHelper.getExecutor(send02);
         assertNotNull(exec);
-        try {
-            Set currentStates = exec.getCurrentStatus().getStates();
-            assertEquals(1, currentStates.size());
-            assertEquals("ninety", ((State)currentStates.iterator().
-                next()).getId());
-            assertTrue(exec.getCurrentStatus().isFinal());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        Set currentStates = exec.getCurrentStatus().getStates();
+        assertEquals(1, currentStates.size());
+        assertEquals("ninety", ((State)currentStates.iterator().
+            next()).getId());
+        assertTrue(exec.getCurrentStatus().isFinal());
     }
 
-    private void checkMicrowave01Sample() {
-        try {
-            Set currentStates = SCXMLTestHelper.fireEvent(exec, "turn_on");
-            assertEquals(1, currentStates.size());
-            assertEquals("cooking", ((State)currentStates.iterator().
-                next()).getId());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+    private void checkMicrowave01Sample() throws Exception {
+        Set currentStates = SCXMLTestHelper.fireEvent(exec, "turn_on");
+        assertEquals(1, currentStates.size());
+        assertEquals("cooking", ((State)currentStates.iterator().
+            next()).getId());
     }
 
-    private void checkMicrowave02Sample() {
-        try {
-            Set currentStates = SCXMLTestHelper.fireEvent(exec, "turn_on");
-            assertEquals(2, currentStates.size());
-            String id = ((State)currentStates.iterator().next()).getId();
-            assertTrue(id.equals("closed") || id.equals("cooking"));
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+    private void checkMicrowave02Sample() throws Exception {
+        Set currentStates = SCXMLTestHelper.fireEvent(exec, "turn_on");
+        assertEquals(2, currentStates.size());
+        String id = ((State)currentStates.iterator().next()).getId();
+        assertTrue(id.equals("closed") || id.equals("cooking"));
     }
 
     public static void main(String args[]) {

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/WildcardTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/WildcardTest.java?rev=730783&r1=730782&r2=730783&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/WildcardTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/WildcardTest.java Fri Jan  2 08:58:59 2009
@@ -68,35 +68,27 @@
     /**
      * Test the SCXML documents, usage of "_eventdata"
      */
-    public void testWildcard01Sample() {
+    public void testWildcard01Sample() throws Exception {
     	exec = SCXMLTestHelper.getExecutor(wildcard01);
         assertNotNull(exec);
-        try {
-            Set currentStates = exec.getCurrentStatus().getStates();
-            assertEquals(1, currentStates.size());
-            assertEquals("state1", ((State)currentStates.iterator().
-                next()).getId());
-            exec = SCXMLTestHelper.testExecutorSerializability(exec);
-            currentStates = SCXMLTestHelper.fireEvent(exec, "foo.bar.baz");
-            assertEquals(1, currentStates.size());
-            assertEquals("state4", ((State)currentStates.iterator().
-                next()).getId());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        Set currentStates = exec.getCurrentStatus().getStates();
+        assertEquals(1, currentStates.size());
+        assertEquals("state1", ((State)currentStates.iterator().
+            next()).getId());
+        exec = SCXMLTestHelper.testExecutorSerializability(exec);
+        currentStates = SCXMLTestHelper.fireEvent(exec, "foo.bar.baz");
+        assertEquals(1, currentStates.size());
+        assertEquals("state4", ((State)currentStates.iterator().
+            next()).getId());
     }
 
-    public void testWildcard02Sample() {
+    public void testWildcard02Sample() throws Exception {
         exec = SCXMLTestHelper.getExecutor(SCXMLTestHelper.parse(wildcard02));
         assertNotNull(exec);
-        try {
-            Set currentStates = exec.getCurrentStatus().getStates();
-            assertEquals(1, currentStates.size());
-            assertEquals("state2", ((State)currentStates.iterator().
-                next()).getId());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        Set currentStates = exec.getCurrentStatus().getStates();
+        assertEquals(1, currentStates.size());
+        assertEquals("state2", ((State)currentStates.iterator().
+            next()).getId());
     }
 
     public static void main(String args[]) {

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/WizardsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/WizardsTest.java?rev=730783&r1=730782&r2=730783&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/WizardsTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/WizardsTest.java Fri Jan  2 08:58:59 2009
@@ -74,58 +74,50 @@
     /**
      * Test the wizard style SCXML documents, and send usage
      */
-    public void testWizard01Sample() {
+    public void testWizard01Sample() throws Exception {
     	exec = SCXMLTestHelper.getExecutor(wizard01);
         assertNotNull(exec);
-        try {
-            Set currentStates = exec.getCurrentStatus().getStates();
-            assertEquals(1, currentStates.size());
-            assertEquals("state1", ((State)currentStates.iterator().
-                next()).getId());
-            exec = SCXMLTestHelper.testExecutorSerializability(exec);
-            currentStates = SCXMLTestHelper.fireEvent(exec, "event2");
-            assertEquals(1, currentStates.size());
-            assertEquals("state2", ((State)currentStates.iterator().
-                next()).getId());
-            currentStates = SCXMLTestHelper.fireEvent(exec, "event4");
-            assertEquals(1, currentStates.size());
-            assertEquals("state4", ((State)currentStates.iterator().
-                next()).getId());
-            currentStates = SCXMLTestHelper.fireEvent(exec, "event3");
-            assertEquals(1, currentStates.size());
-            assertEquals("state3", ((State)currentStates.iterator().
-                next()).getId());
-            exec = SCXMLTestHelper.testExecutorSerializability(exec);
-            currentStates = SCXMLTestHelper.fireEvent(exec, "event3"); // ensure we stay put
-            assertEquals(1, currentStates.size());
-            assertEquals("state3", ((State)currentStates.iterator().
-                next()).getId());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        Set currentStates = exec.getCurrentStatus().getStates();
+        assertEquals(1, currentStates.size());
+        assertEquals("state1", ((State)currentStates.iterator().
+            next()).getId());
+        exec = SCXMLTestHelper.testExecutorSerializability(exec);
+        currentStates = SCXMLTestHelper.fireEvent(exec, "event2");
+        assertEquals(1, currentStates.size());
+        assertEquals("state2", ((State)currentStates.iterator().
+            next()).getId());
+        currentStates = SCXMLTestHelper.fireEvent(exec, "event4");
+        assertEquals(1, currentStates.size());
+        assertEquals("state4", ((State)currentStates.iterator().
+            next()).getId());
+        currentStates = SCXMLTestHelper.fireEvent(exec, "event3");
+        assertEquals(1, currentStates.size());
+        assertEquals("state3", ((State)currentStates.iterator().
+            next()).getId());
+        exec = SCXMLTestHelper.testExecutorSerializability(exec);
+        currentStates = SCXMLTestHelper.fireEvent(exec, "event3"); // ensure we stay put
+        assertEquals(1, currentStates.size());
+        assertEquals("state3", ((State)currentStates.iterator().
+            next()).getId());
     }
 
-    public void testWizard02Sample() {
+    public void testWizard02Sample() throws Exception {
         SCXML scxml = SCXMLTestHelper.digest(wizard02);
         exec = SCXMLTestHelper.getExecutor(new JexlContext(),
             new JexlEvaluator(), scxml, new TestEventDispatcher(),
             new Tracer());
         assertNotNull(exec);
-        try {
-            // If you change this, you must also change
-            // the TestEventDispatcher
-            Set currentStates = exec.getCurrentStatus().getStates();
-            assertEquals(1, currentStates.size());
-            assertEquals("state2", ((State)currentStates.iterator().
-                next()).getId());
-            exec = SCXMLTestHelper.testExecutorSerializability(exec);
-            currentStates = SCXMLTestHelper.fireEvent(exec, "event4");
-            assertEquals(1, currentStates.size());
-            assertEquals("state4", ((State)currentStates.iterator().
-                next()).getId());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        // If you change this, you must also change
+        // the TestEventDispatcher
+        Set currentStates = exec.getCurrentStatus().getStates();
+        assertEquals(1, currentStates.size());
+        assertEquals("state2", ((State)currentStates.iterator().
+            next()).getId());
+        exec = SCXMLTestHelper.testExecutorSerializability(exec);
+        currentStates = SCXMLTestHelper.fireEvent(exec, "event4");
+        assertEquals(1, currentStates.size());
+        assertEquals("state4", ((State)currentStates.iterator().
+            next()).getId());
     }
 
     static class TestEventDispatcher implements EventDispatcher, Serializable {

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jsp/RootContextTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jsp/RootContextTest.java?rev=730783&r1=730782&r2=730783&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jsp/RootContextTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/env/jsp/RootContextTest.java Fri Jan  2 08:58:59 2009
@@ -79,7 +79,7 @@
     /**
      * Test the implementation
      */
-    public void testRootContext() {
+    public void testRootContext() throws Exception {
         assertEquals("1", String.valueOf(rootCtx.get("foo")));
         exec = SCXMLTestHelper.getExecutor(rootCtxSample, rootCtx, evaluator);
         assertEquals("1", String.valueOf(jspCtx.getAttribute("foo")));
@@ -89,13 +89,9 @@
             "rootCtxTest");
         assertNotNull(ctx);
         assertNotNull(ctx.get("bar"));
-        try {
-            assertNull(jspCtx.getVariableResolver().resolveVariable("bar"));
-            assertNotNull(ctx.resolveVariable("bar"));
-            assertEquals(ctx.resolveVariable("bar"), "a brand new value");
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        assertNull(jspCtx.getVariableResolver().resolveVariable("bar"));
+        assertNotNull(ctx.resolveVariable("bar"));
+        assertEquals(ctx.resolveVariable("bar"), "a brand new value");
         assertNotNull(ctx.getVars());
     }
 

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/invoke/InvokeParamNameTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/invoke/InvokeParamNameTest.java?rev=730783&r1=730782&r2=730783&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/invoke/InvokeParamNameTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/invoke/InvokeParamNameTest.java Fri Jan  2 08:58:59 2009
@@ -78,43 +78,31 @@
     }
     
     // Tests "param" element with "name" and "expr" attribute
-    public void testNameAndExpr() {
-        try {
-            trigger();
-            assertTrue(lastSource.endsWith("TestSrc"));
-            final Map.Entry e = (Map.Entry)lastParams.entrySet().iterator().next();
-            assertEquals("ding", e.getKey());
-            assertEquals("foo", e.getValue());
-        } catch (ModelException e) {
-           fail("ModelException: " + e.getMessage());
-        }
+    public void testNameAndExpr() throws Exception {
+        trigger();
+        assertTrue(lastSource.endsWith("TestSrc"));
+        final Map.Entry e = (Map.Entry)lastParams.entrySet().iterator().next();
+        assertEquals("ding", e.getKey());
+        assertEquals("foo", e.getValue());
     }
 
     // Tests "param" element with only a "name" attribute 
-    public void testSoleNameLocation() {
-        try {
-            trigger(); trigger();
-            final Element e = (Element)lastParams.values().iterator().next();
-            assertNotNull(e);
-            assertEquals("bar", e.getNodeName());
-            assertEquals(Node.TEXT_NODE, e.getFirstChild().getNodeType());
-            assertEquals("foo", e.getFirstChild().getNodeValue());
-        } catch (ModelException e) {
-           fail("ModelException: " + e.getMessage());
-        }
+    public void testSoleNameLocation() throws Exception {
+        trigger(); trigger();
+        final Element e = (Element)lastParams.values().iterator().next();
+        assertNotNull(e);
+        assertEquals("bar", e.getNodeName());
+        assertEquals(Node.TEXT_NODE, e.getFirstChild().getNodeType());
+        assertEquals("foo", e.getFirstChild().getNodeValue());
     }
 
     // Tests "param" element with a single, wrong "name" attribute
-    public void testWrongNameLocation() {
-        try {
-            trigger(); trigger(); trigger();
-            assertEquals(1, exec.getCurrentStatus().getEvents().size());
-            final TriggerEvent evt = (TriggerEvent) 
-                exec.getCurrentStatus().getEvents().iterator().next(); 
-            assertTrue(evt.getName().endsWith("error.illegalalloc"));
-        } catch (ModelException e) {
-           fail("ModelException: " + e.getMessage());
-        }
+    public void testWrongNameLocation() throws Exception {
+        trigger(); trigger(); trigger();
+        assertEquals(1, exec.getCurrentStatus().getEvents().size());
+        final TriggerEvent evt = (TriggerEvent) 
+            exec.getCurrentStatus().getEvents().iterator().next(); 
+        assertTrue(evt.getName().endsWith("error.illegalalloc"));
     }
 
     public static class DummyInvoker implements Invoker {

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/StateSrcTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/StateSrcTest.java?rev=730783&r1=730782&r2=730783&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/StateSrcTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/io/StateSrcTest.java Fri Jan  2 08:58:59 2009
@@ -92,29 +92,23 @@
         assertTrue(exec.getCurrentStatus().isFinal());
     }
 
-    public void testBadSrcInclude() {
+    public void testBadSrcInclude() throws Exception {
         try {
             scxml = SCXMLParser.parse(src04, new SimpleErrorHandler());
             fail("Document with bad <state> src attribute shouldn't be parsed!");
         } catch (SAXException me) {
             assertTrue("Unexpected error message for bad <state> 'src' URI",
                 me.getMessage() != null && me.getMessage().indexOf("Source attribute in <state src=") != -1);
-        } catch (Exception e) {
-            fail("Unexpected exception [" + e.getClass().getName() + ":" +
-                e.getMessage() + "]");
         }
     }
 
-    public void testBadSrcFragmentInclude() {
+    public void testBadSrcFragmentInclude() throws Exception {
         try {
             scxml = SCXMLParser.parse(src05, new SimpleErrorHandler());
             fail("Document with bad <state> src attribute shouldn't be parsed!");
         } catch (SAXException me) {
             assertTrue("Unexpected error message for bad <state> 'src' URI fragment",
                 me.getMessage() != null && me.getMessage().indexOf("URI Fragment in <state src=") != -1);
-        } catch (Exception e) {
-            fail("Unexpected exception [" + e.getClass().getName() + ":" +
-                e.getMessage() + "]");
         }
     }
 

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/CustomActionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/CustomActionTest.java?rev=730783&r1=730782&r2=730783&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/CustomActionTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/CustomActionTest.java Fri Jan  2 08:58:59 2009
@@ -72,13 +72,9 @@
         exec = null;
     }
 
-    public void testAddGoodCustomAction01() {
-        try {
-            new CustomAction("http://my.actions.domain/CUSTOM", "hello",
+    public void testAddGoodCustomAction01() throws Exception {
+        new CustomAction("http://my.actions.domain/CUSTOM", "hello",
                 Hello.class);
-        } catch (IllegalArgumentException iae) {
-            fail("Failed to add custom action &quot;Hello&quot;");
-        }
     }
 
     public void testAddBadCustomAction01() {

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/DatamodelTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/DatamodelTest.java?rev=730783&r1=730782&r2=730783&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/DatamodelTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/DatamodelTest.java Fri Jan  2 08:58:59 2009
@@ -81,7 +81,7 @@
     /**
      * Test the stateless model, simultaneous executions
      */
-    public void testDatamodelSimultaneousJexl() {
+    public void testDatamodelSimultaneousJexl() throws Exception {
         exec01 = SCXMLTestHelper.getExecutor(datamodel01jexl,
             new JexlContext(), new JexlEvaluator());
         assertNotNull(exec01);
@@ -92,7 +92,7 @@
         runtest();
     }
 
-    public void testDatamodelSimultaneousJsp() {
+    public void testDatamodelSimultaneousJsp() throws Exception {
         exec01 = SCXMLTestHelper.getExecutor(datamodel01jsp,
             new ELContext(), new ELEvaluator());
         assertNotNull(exec01);
@@ -103,7 +103,7 @@
         runtest();
     }
 
-    public void testDatamodelNamespacePrefixedXPaths() {
+    public void testDatamodelNamespacePrefixedXPaths() throws Exception {
         exec01 = SCXMLTestHelper.getExecutor(datamodel02jexl,
             new JexlContext(), new JexlEvaluator());
         assertNotNull(exec01);
@@ -138,62 +138,54 @@
             next()).getId());
     }
 
-    private void runtest() {
-        try {
-            //// Interleaved
-            // exec01
-            Set currentStates = exec01.getCurrentStatus().getStates();
-            assertEquals(1, currentStates.size());
-            assertEquals("ten", ((State)currentStates.iterator().
-                next()).getId());
-            exec01 = SCXMLTestHelper.testExecutorSerializability(exec01);
-            currentStates = fireEvent("ten.done", exec01);
-            assertEquals(1, currentStates.size());
-            assertEquals("twenty", ((State)currentStates.iterator().
-                next()).getId());
-            // exec02
-            currentStates = exec02.getCurrentStatus().getStates();
-            assertEquals(1, currentStates.size());
-            assertEquals("ten", ((State)currentStates.iterator().
-                next()).getId());
-            // exec01
-            currentStates = fireEvent("twenty.done", exec01);
-            assertEquals(1, currentStates.size());
-            assertEquals("thirty", ((State)currentStates.iterator().
-                next()).getId());
-            exec01 = SCXMLTestHelper.testExecutorSerializability(exec01);
-            // exec02
-            currentStates = fireEvent("ten.done", exec02);
-            assertEquals(1, currentStates.size());
-            assertEquals("twenty", ((State)currentStates.iterator().
-                next()).getId());
-            exec02 = SCXMLTestHelper.testExecutorSerializability(exec02);
-            currentStates = fireEvent("twenty.done", exec02);
-            assertEquals(1, currentStates.size());
-            assertEquals("thirty", ((State)currentStates.iterator().
-                next()).getId());
-            currentStates = fireEvent("thirty.done", exec02);
-            assertEquals(1, currentStates.size());
-            assertEquals("forty", ((State)currentStates.iterator().
-                next()).getId());
-            // exec01
-            currentStates = fireEvent("thirty.done", exec01);
-            assertEquals(1, currentStates.size());
-            assertEquals("forty", ((State)currentStates.iterator().
-                next()).getId());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+    private void runtest() throws Exception {
+        //// Interleaved
+        // exec01
+        Set currentStates = exec01.getCurrentStatus().getStates();
+        assertEquals(1, currentStates.size());
+        assertEquals("ten", ((State)currentStates.iterator().
+            next()).getId());
+        exec01 = SCXMLTestHelper.testExecutorSerializability(exec01);
+        currentStates = fireEvent("ten.done", exec01);
+        assertEquals(1, currentStates.size());
+        assertEquals("twenty", ((State)currentStates.iterator().
+            next()).getId());
+        // exec02
+        currentStates = exec02.getCurrentStatus().getStates();
+        assertEquals(1, currentStates.size());
+        assertEquals("ten", ((State)currentStates.iterator().
+            next()).getId());
+        // exec01
+        currentStates = fireEvent("twenty.done", exec01);
+        assertEquals(1, currentStates.size());
+        assertEquals("thirty", ((State)currentStates.iterator().
+            next()).getId());
+        exec01 = SCXMLTestHelper.testExecutorSerializability(exec01);
+        // exec02
+        currentStates = fireEvent("ten.done", exec02);
+        assertEquals(1, currentStates.size());
+        assertEquals("twenty", ((State)currentStates.iterator().
+            next()).getId());
+        exec02 = SCXMLTestHelper.testExecutorSerializability(exec02);
+        currentStates = fireEvent("twenty.done", exec02);
+        assertEquals(1, currentStates.size());
+        assertEquals("thirty", ((State)currentStates.iterator().
+            next()).getId());
+        currentStates = fireEvent("thirty.done", exec02);
+        assertEquals(1, currentStates.size());
+        assertEquals("forty", ((State)currentStates.iterator().
+            next()).getId());
+        // exec01
+        currentStates = fireEvent("thirty.done", exec01);
+        assertEquals(1, currentStates.size());
+        assertEquals("forty", ((State)currentStates.iterator().
+            next()).getId());
     }
 
-    private Set fireEvent(String name, SCXMLExecutor exec) {
+    private Set fireEvent(String name, SCXMLExecutor exec) throws Exception {
         TriggerEvent[] evts = {new TriggerEvent(name,
                 TriggerEvent.SIGNAL_EVENT, null)};
-        try {
-            exec.triggerEvents(evts);
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        exec.triggerEvents(evts);
         return exec.getCurrentStatus().getStates();
     }
 

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/HistoryTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/HistoryTest.java?rev=730783&r1=730782&r2=730783&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/HistoryTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/HistoryTest.java Fri Jan  2 08:58:59 2009
@@ -86,12 +86,12 @@
         assertFalse(history.isDeep());
     }
 
-    public void testShallowHistory01() {
+    public void testShallowHistory01() throws Exception {
         exec = SCXMLTestHelper.getExecutor(shallow01);
         runHistoryFlow();
     }
 
-    public void testDeepHistory01() {
+    public void testDeepHistory01() throws Exception {
         exec = SCXMLTestHelper.getExecutor(deep01);
         runHistoryFlow();
     }
@@ -112,7 +112,7 @@
             next()).getId());
     }
 
-    private void runHistoryFlow() {
+    private void runHistoryFlow() throws Exception {
         Set currentStates = exec.getCurrentStatus().getStates();
         assertEquals(1, currentStates.size());
         assertEquals("phase1", ((State)currentStates.iterator().
@@ -124,11 +124,7 @@
         assertEquals("phase2", pauseAndResume());
         assertEquals("phase3", nextPhase());
         assertEquals("phase3", pauseAndResume());
-        try {
-            exec.reset();
-        } catch (ModelException me) {
-            fail(me.getMessage());
-        }
+        exec.reset();
         currentStates = exec.getCurrentStatus().getStates();
         assertEquals(1, currentStates.size());
         assertEquals("phase1", ((State)currentStates.iterator().

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/ParallelTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/ParallelTest.java?rev=730783&r1=730782&r2=730783&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/ParallelTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/ParallelTest.java Fri Jan  2 08:58:59 2009
@@ -62,52 +62,40 @@
         exec = null;
     }
 
-    public void testParallel01() {
+    public void testParallel01() throws Exception {
         SCXML scxml = SCXMLTestHelper.parse(parallel01);
         assertNotNull(scxml);
         exec = SCXMLTestHelper.getExecutor(scxml);
         assertNotNull(exec);
-        try {
-            SCXMLTestHelper.assertPostTriggerState(exec, "foo", "end");
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        SCXMLTestHelper.assertPostTriggerState(exec, "foo", "end");
     }
 
-    public void testParallel02() {
+    public void testParallel02() throws Exception {
         SCXML scxml = SCXMLTestHelper.parse(parallel02);
         assertNotNull(scxml);
         exec = SCXMLTestHelper.getExecutor(scxml);
         assertNotNull(exec);
-        try {
-            SCXMLTestHelper.assertPostTriggerStates(exec, "dummy.event", new String[] { "state01", "state02" });
-            SCXMLTestHelper.assertPostTriggerState(exec, "event1", "state1");
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        SCXMLTestHelper.assertPostTriggerStates(exec, "dummy.event", new String[] { "state01", "state02" });
+        SCXMLTestHelper.assertPostTriggerState(exec, "event1", "state1");
     }
 
-    public void testParallel03() {
+    public void testParallel03() throws Exception {
         SCXML scxml = SCXMLTestHelper.parse(parallel03);
         assertNotNull(scxml);
         exec = SCXMLTestHelper.getExecutor(scxml);
         assertNotNull(exec);
-        try {
-            SCXMLTestHelper.assertPostTriggerStates(exec, "dummy.event", new String[] { "para11", "para21" });
-            Node data = (Node) exec.getRootContext().get("root");
-            Map namespaces = new HashMap();
-            namespaces.put("", "http://www.w3.org/2005/07/scxml");
-            Object count = Builtin.data(namespaces, data, "root/count");
-            assertEquals("5.0", count.toString());
-            SCXMLTestHelper.assertPostTriggerStates(exec, "foo", new String[] { "para12", "para21" });
-            count = Builtin.data(namespaces, data, "root/count");
-            assertEquals("7.0", count.toString());
-            SCXMLTestHelper.assertPostTriggerState(exec, "bar", "end");
-            count = Builtin.data(namespaces, data, "root/count");
-            assertEquals("14.0", count.toString());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        SCXMLTestHelper.assertPostTriggerStates(exec, "dummy.event", new String[] { "para11", "para21" });
+        Node data = (Node) exec.getRootContext().get("root");
+        Map namespaces = new HashMap();
+        namespaces.put("", "http://www.w3.org/2005/07/scxml");
+        Object count = Builtin.data(namespaces, data, "root/count");
+        assertEquals("5.0", count.toString());
+        SCXMLTestHelper.assertPostTriggerStates(exec, "foo", new String[] { "para12", "para21" });
+        count = Builtin.data(namespaces, data, "root/count");
+        assertEquals("7.0", count.toString());
+        SCXMLTestHelper.assertPostTriggerState(exec, "bar", "end");
+        count = Builtin.data(namespaces, data, "root/count");
+        assertEquals("14.0", count.toString());
     }
 
 }

Modified: commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/StatelessModelTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/StatelessModelTest.java?rev=730783&r1=730782&r2=730783&view=diff
==============================================================================
--- commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/StatelessModelTest.java (original)
+++ commons/proper/scxml/trunk/src/test/java/org/apache/commons/scxml/model/StatelessModelTest.java Fri Jan  2 08:58:59 2009
@@ -79,7 +79,7 @@
     /**
      * Test the stateless model, simultaneous executions, JEXL expressions
      */
-    public void testStatelessModelSimultaneousJexl() {
+    public void testStatelessModelSimultaneousJexl() throws Exception {
     	// parse once, use many times
         exec01 = SCXMLTestHelper.getExecutor(scxml01jexl);
         assertNotNull(exec01);
@@ -92,7 +92,7 @@
     /**
      * Test the stateless model, sequential executions, JEXL expressions
      */
-    public void testStatelessModelSequentialJexl() {
+    public void testStatelessModelSequentialJexl() throws Exception {
         // rinse and repeat
         for (int i = 0; i < 3; i++) {
             exec01 = SCXMLTestHelper.getExecutor(scxml01jexl);
@@ -104,7 +104,7 @@
     /**
      * Test the stateless model, simultaneous executions, EL expressions
      */
-    public void testStatelessModelSimultaneousEl() {
+    public void testStatelessModelSimultaneousEl() throws Exception {
     	// parse once, use many times
         exec01 = SCXMLTestHelper.getExecutor(scxml01jsp,
             new ELContext(), new ELEvaluator());
@@ -119,7 +119,7 @@
     /**
      * Test the stateless model, sequential executions, EL expressions
      */
-    public void testStatelessModelSequentialEl() {
+    public void testStatelessModelSequentialEl() throws Exception {
         // rinse and repeat
         for (int i = 0; i < 3; i++) {
             exec01 = SCXMLTestHelper.getExecutor(scxml01jsp,
@@ -132,7 +132,7 @@
     /**
      * Test sharing a single SCXML object between two executors
      */
-    public void testStatelessModelParallelSharedSCXML() {
+    public void testStatelessModelParallelSharedSCXML() throws Exception {
         exec01 = SCXMLTestHelper.getExecutor(scxml01par);
         assertNotNull(exec01);
         exec02 = SCXMLTestHelper.getExecutor(scxml01par);
@@ -161,7 +161,7 @@
     /**
      * Test sharing two SCXML objects between one executor (not recommended)
      */
-    public void testStatelessModelParallelSwapSCXML() {
+    public void testStatelessModelParallelSwapSCXML() throws Exception {
         exec01 = SCXMLTestHelper.getExecutor(scxml01par);
         assertNotNull(exec01);
         assertTrue(scxml01par != scxml02par);
@@ -206,69 +206,57 @@
         fail(label + " in unexpected state " + cs1);
     }
 
-    private void runSimultaneousTest() {
-        try {
-            //// Interleaved
-            // exec01
-            Set currentStates = exec01.getCurrentStatus().getStates();
-            assertEquals(1, currentStates.size());
-            assertEquals("ten", ((State)currentStates.iterator().
-                next()).getId());
-            currentStates = fireEvent("ten.done", exec01);
-            assertEquals(1, currentStates.size());
-            assertEquals("twenty", ((State)currentStates.iterator().
-                next()).getId());
-            // exec02
-            currentStates = exec02.getCurrentStatus().getStates();
-            assertEquals(1, currentStates.size());
-            assertEquals("ten", ((State)currentStates.iterator().
-                next()).getId());
-            // exec01
-            currentStates = fireEvent("twenty.done", exec01);
-            assertEquals(1, currentStates.size());
-            assertEquals("thirty", ((State)currentStates.iterator().
-                next()).getId());
-            // exec02
-            currentStates = fireEvent("ten.done", exec02);
-            assertEquals(1, currentStates.size());
-            assertEquals("twenty", ((State)currentStates.iterator().
-                next()).getId());
-            currentStates = fireEvent("twenty.done", exec02);
-            assertEquals(1, currentStates.size());
-            assertEquals("thirty", ((State)currentStates.iterator().
-                next()).getId());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+    private void runSimultaneousTest() throws Exception {
+        //// Interleaved
+        // exec01
+        Set currentStates = exec01.getCurrentStatus().getStates();
+        assertEquals(1, currentStates.size());
+        assertEquals("ten", ((State)currentStates.iterator().
+            next()).getId());
+        currentStates = fireEvent("ten.done", exec01);
+        assertEquals(1, currentStates.size());
+        assertEquals("twenty", ((State)currentStates.iterator().
+            next()).getId());
+        // exec02
+        currentStates = exec02.getCurrentStatus().getStates();
+        assertEquals(1, currentStates.size());
+        assertEquals("ten", ((State)currentStates.iterator().
+            next()).getId());
+        // exec01
+        currentStates = fireEvent("twenty.done", exec01);
+        assertEquals(1, currentStates.size());
+        assertEquals("thirty", ((State)currentStates.iterator().
+            next()).getId());
+        // exec02
+        currentStates = fireEvent("ten.done", exec02);
+        assertEquals(1, currentStates.size());
+        assertEquals("twenty", ((State)currentStates.iterator().
+            next()).getId());
+        currentStates = fireEvent("twenty.done", exec02);
+        assertEquals(1, currentStates.size());
+        assertEquals("thirty", ((State)currentStates.iterator().
+            next()).getId());
     }
 
-    private void runSequentialTest() {
-        try {
-            Set currentStates = exec01.getCurrentStatus().getStates();
-            assertEquals(1, currentStates.size());
-            assertEquals("ten", ((State)currentStates.iterator().
-                next()).getId());
-            currentStates = fireEvent("ten.done", exec01);
-            assertEquals(1, currentStates.size());
-            assertEquals("twenty", ((State)currentStates.iterator().
-                next()).getId());
-            currentStates = fireEvent("twenty.done", exec01);
-            assertEquals(1, currentStates.size());
-            assertEquals("thirty", ((State)currentStates.iterator().
-                next()).getId());
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }    	
+    private void runSequentialTest() throws Exception {
+        Set currentStates = exec01.getCurrentStatus().getStates();
+        assertEquals(1, currentStates.size());
+        assertEquals("ten", ((State)currentStates.iterator().
+            next()).getId());
+        currentStates = fireEvent("ten.done", exec01);
+        assertEquals(1, currentStates.size());
+        assertEquals("twenty", ((State)currentStates.iterator().
+            next()).getId());
+        currentStates = fireEvent("twenty.done", exec01);
+        assertEquals(1, currentStates.size());
+        assertEquals("thirty", ((State)currentStates.iterator().
+            next()).getId());
     }
 
-    private Set fireEvent(String name, SCXMLExecutor exec) {
+    private Set fireEvent(String name, SCXMLExecutor exec) throws Exception {
         TriggerEvent[] evts = {new TriggerEvent(name,
                 TriggerEvent.SIGNAL_EVENT, null)};
-        try {
-            exec.triggerEvents(evts);
-        } catch (Exception e) {
-            fail(e.getMessage());
-        }
+        exec.triggerEvents(evts);
         return exec.getCurrentStatus().getStates();
     }
 



Mime
View raw message