commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject svn commit: r651785 - /commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/
Date Sat, 26 Apr 2008 01:56:57 GMT
Author: rahul
Date: Fri Apr 25 18:56:55 2008
New Revision: 651785

URL: http://svn.apache.org/viewvc?rev=651785&view=rev
Log:
Type safety improvements.

Modified:
    commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/EventDataTest.java
    commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/NamespacePrefixedXPathsTest.java
    commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCInstanceTest.java
    commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
    commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLHelperTest.java
    commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java
    commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/TieBreakerTest.java
    commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/WildcardTest.java
    commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/WizardsTest.java

Modified: commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/EventDataTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/EventDataTest.java?rev=651785&r1=651784&r2=651785&view=diff
==============================================================================
--- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/EventDataTest.java
(original)
+++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/EventDataTest.java
Fri Apr 25 18:56:55 2008
@@ -24,7 +24,7 @@
 import junit.framework.TestSuite;
 import junit.textui.TestRunner;
 
-import org.apache.commons.scxml.model.State;
+import org.apache.commons.scxml.model.TransitionTarget;
 /**
  * Unit tests {@link org.apache.commons.scxml.SCXMLExecutor}.
  * Testing special variable "_eventdata"
@@ -74,29 +74,25 @@
     	exec = SCXMLTestHelper.getExecutor(eventdata01);
         assertNotNull(exec);
         try {
-            Set currentStates = exec.getCurrentStatus().getStates();
+            Set<TransitionTarget> currentStates = exec.getCurrentStatus().getStates();
             assertEquals(1, currentStates.size());
-            assertEquals("state1", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("state1", 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());
+            assertEquals("state3", 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());
+            assertEquals("state6", 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());
+            assertEquals("state7", currentStates.iterator().next().getId());
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -106,23 +102,20 @@
     	exec = SCXMLTestHelper.getExecutor(eventdata02);
         assertNotNull(exec);
         try {
-            Set currentStates = exec.getCurrentStatus().getStates();
+            Set<TransitionTarget> currentStates = exec.getCurrentStatus().getStates();
             assertEquals(1, currentStates.size());
-            assertEquals("state0", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("state0", 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());
+            assertEquals("state2", 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());
+            assertEquals("state4", currentStates.iterator().next().getId());
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -132,16 +125,14 @@
         exec = SCXMLTestHelper.getExecutor(eventdata03);
         assertNotNull(exec);
         try {
-            Set currentStates = exec.getCurrentStatus().getStates();
+            Set<TransitionTarget> currentStates = exec.getCurrentStatus().getStates();
             assertEquals(1, currentStates.size());
-            assertEquals("ten", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("ten", 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());
+            assertEquals("thirty", currentStates.iterator().next().getId());
         } catch (Exception e) {
             fail(e.getMessage());
         }

Modified: commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/NamespacePrefixedXPathsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/NamespacePrefixedXPathsTest.java?rev=651785&r1=651784&r2=651785&view=diff
==============================================================================
--- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/NamespacePrefixedXPathsTest.java
(original)
+++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/NamespacePrefixedXPathsTest.java
Fri Apr 25 18:56:55 2008
@@ -27,6 +27,7 @@
 import org.apache.commons.scxml.env.jsp.ELContext;
 import org.apache.commons.scxml.env.jsp.ELEvaluator;
 import org.apache.commons.scxml.model.State;
+import org.apache.commons.scxml.model.TransitionTarget;
 
 /**
  * Unit tests for namespace prefixes in XPaths pointing bits in a &lt;data&gt;.
@@ -90,16 +91,14 @@
         try {
 
             // must be in state "ten" at the onset
-            Set currentStates = exec.getCurrentStatus().getStates();
+            Set<TransitionTarget> currentStates = exec.getCurrentStatus().getStates();
             assertEquals(1, currentStates.size());
-            assertEquals("ten", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("ten", 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());
+            assertEquals("twenty", currentStates.iterator().next().getId());
 
             // This is set while exiting "ten"
             Double retval = (Double) exec.getRootContext().get("retval");
@@ -108,8 +107,7 @@
             // On to "thirty"
             currentStates = SCXMLTestHelper.fireEvent(exec, "twenty.done");
             assertEquals(1, currentStates.size());
-            assertEquals("thirty", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("thirty", currentStates.iterator().next().getId());
             exec = SCXMLTestHelper.testExecutorSerializability(exec);
 
             // Tests XPath on SCXML actions, set while exiting "twenty"
@@ -119,13 +117,11 @@
             // and so on ...
             currentStates = SCXMLTestHelper.fireEvent(exec, "thirty.done");
             assertEquals(1, currentStates.size());
-            assertEquals("forty", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("forty", currentStates.iterator().next().getId());
 
             currentStates = SCXMLTestHelper.fireEvent(exec, "forty.done");
             assertEquals(1, currentStates.size());
-            assertEquals("fifty", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("fifty", currentStates.iterator().next().getId());
 
             currentStates = SCXMLTestHelper.fireEvent(exec, "fifty.done");
             assertEquals(1, currentStates.size());
@@ -134,8 +130,7 @@
 
             currentStates = SCXMLTestHelper.fireEvent(exec, "sixty.done");
             assertEquals(1, currentStates.size());
-            assertEquals("seventy", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("seventy", currentStates.iterator().next().getId());
 
             // done
             assertTrue(exec.getCurrentStatus().isFinal());

Modified: commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCInstanceTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCInstanceTest.java?rev=651785&r1=651784&r2=651785&view=diff
==============================================================================
--- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCInstanceTest.java
(original)
+++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCInstanceTest.java
Fri Apr 25 18:56:55 2008
@@ -121,7 +121,7 @@
     public void testGetLastConfigurationNull() {
         History history = new History();
         
-        Set returnConfiguration = instance.getLastConfiguration(history);
+        Set<TransitionTarget> returnConfiguration = instance.getLastConfiguration(history);
         
         assertEquals(0, returnConfiguration.size());
     }
@@ -139,7 +139,7 @@
         
         instance.setLastConfiguration(history, configuration);  
         
-        Set returnConfiguration = instance.getLastConfiguration(history);
+        Set<TransitionTarget> returnConfiguration = instance.getLastConfiguration(history);
         
         assertEquals(2, returnConfiguration.size());
         assertTrue(returnConfiguration.contains(tt1));

Modified: commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java?rev=651785&r1=651784&r2=651785&view=diff
==============================================================================
--- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
(original)
+++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
Fri Apr 25 18:56:55 2008
@@ -156,28 +156,24 @@
     public void testSCXMLExecutorPrefix01Sample() {
         exec = SCXMLTestHelper.getExecutor(prefix01);
         assertNotNull(exec);
-        Set currentStates = exec.getCurrentStatus().getStates();
+        Set<TransitionTarget> currentStates = exec.getCurrentStatus().getStates();
         assertEquals(1, currentStates.size());
-        assertEquals("ten", ((State)currentStates.iterator().
-            next()).getId());
+        assertEquals("ten", currentStates.iterator().next().getId());
         currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
         assertEquals(1, currentStates.size());
-        assertEquals("twenty", ((State)currentStates.iterator().
-            next()).getId());
+        assertEquals("twenty", currentStates.iterator().next().getId());
     }
 
     public void testSCXMLExecutorTransitions01Sample() {
         exec = SCXMLTestHelper.getExecutor(transitions01);
         assertNotNull(exec);
         try {
-            Set currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
+            Set<TransitionTarget> currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
             assertEquals(1, currentStates.size());
-            assertEquals("twenty_one", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("twenty_one", currentStates.iterator().next().getId());
             currentStates = SCXMLTestHelper.fireEvent(exec, "twenty_one.done");
             assertEquals(1, currentStates.size());
-            assertEquals("twenty_two", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("twenty_two", currentStates.iterator().next().getId());
             currentStates = SCXMLTestHelper.fireEvent(exec, "twenty_two.done");
             assertEquals(3, exec.getCurrentStatus().getStates().size());
         } catch (Exception e) {
@@ -189,19 +185,16 @@
         exec = SCXMLTestHelper.getExecutor(transitions02);
         assertNotNull(exec);
         try {
-            Set currentStates = SCXMLTestHelper.fireEvent(exec, "ten.stay");
+            Set<TransitionTarget> currentStates = SCXMLTestHelper.fireEvent(exec, "ten.stay");
             assertEquals(1, currentStates.size());
-            assertEquals("ten", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("ten", 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());
+            assertEquals("ten", currentStates.iterator().next().getId());
             currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
             assertEquals(1, currentStates.size());
-            assertEquals("twenty", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("twenty", currentStates.iterator().next().getId());
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -260,14 +253,12 @@
         exec = SCXMLTestHelper.getExecutor(send01);
         assertNotNull(exec);
         try {
-            Set currentStates = exec.getCurrentStatus().getStates();
+            Set<TransitionTarget> currentStates = exec.getCurrentStatus().getStates();
             assertEquals(1, currentStates.size());
-            assertEquals("ten", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("ten", currentStates.iterator().next().getId());
             currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
             assertEquals(1, currentStates.size());
-            assertEquals("twenty", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("twenty", currentStates.iterator().next().getId());
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -277,10 +268,9 @@
         exec = SCXMLTestHelper.getExecutor(send02);
         assertNotNull(exec);
         try {
-            Set currentStates = exec.getCurrentStatus().getStates();
+            Set<TransitionTarget> currentStates = exec.getCurrentStatus().getStates();
             assertEquals(1, currentStates.size());
-            assertEquals("ninety", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("ninety", currentStates.iterator().next().getId());
             assertTrue(exec.getCurrentStatus().isFinal());
         } catch (Exception e) {
             fail(e.getMessage());
@@ -289,10 +279,9 @@
 
     private void checkMicrowave01Sample() {
         try {
-            Set currentStates = SCXMLTestHelper.fireEvent(exec, "turn_on");
+            Set<TransitionTarget> currentStates = SCXMLTestHelper.fireEvent(exec, "turn_on");
             assertEquals(1, currentStates.size());
-            assertEquals("cooking", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("cooking", currentStates.iterator().next().getId());
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -300,7 +289,7 @@
 
     private void checkMicrowave02Sample() {
         try {
-            Set currentStates = SCXMLTestHelper.fireEvent(exec, "turn_on");
+            Set<TransitionTarget> currentStates = SCXMLTestHelper.fireEvent(exec, "turn_on");
             assertEquals(2, currentStates.size());
             String id = ((State)currentStates.iterator().next()).getId();
             assertTrue(id.equals("closed") || id.equals("cooking"));

Modified: commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLHelperTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLHelperTest.java?rev=651785&r1=651784&r2=651785&view=diff
==============================================================================
--- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLHelperTest.java
(original)
+++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLHelperTest.java
Fri Apr 25 18:56:55 2008
@@ -94,7 +94,7 @@
     public void testGetAncestorClosureEmptySet() {
         Set<TransitionTarget> states = new HashSet<TransitionTarget>();
         
-        Set returnValue = SCXMLHelper.getAncestorClosure(states, new HashSet<TransitionTarget>());
+        Set<TransitionTarget> returnValue = SCXMLHelper.getAncestorClosure(states,
new HashSet<TransitionTarget>());
         
         assertEquals(0, returnValue.size());
     }
@@ -108,7 +108,7 @@
         Set<TransitionTarget> upperBounds = new HashSet<TransitionTarget>();
         upperBounds.add(state);
         
-        Set returnValue = SCXMLHelper.getAncestorClosure(states, upperBounds);
+        Set<TransitionTarget> returnValue = SCXMLHelper.getAncestorClosure(states,
upperBounds);
         
         assertEquals(1, returnValue.size());
         assertEquals("1", ((TransitionTarget)returnValue.toArray()[0]).getId());
@@ -123,7 +123,7 @@
         
         Set<TransitionTarget> upperBounds = new HashSet<TransitionTarget>();
         
-        Set returnValue = SCXMLHelper.getAncestorClosure(states, upperBounds);
+        Set<TransitionTarget> returnValue = SCXMLHelper.getAncestorClosure(states,
upperBounds);
         
         assertEquals(1, returnValue.size());
         assertEquals("1", ((TransitionTarget)returnValue.toArray()[0]).getId());

Modified: commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java?rev=651785&r1=651784&r2=651785&view=diff
==============================================================================
--- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java
(original)
+++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java
Fri Apr 25 18:56:55 2008
@@ -39,7 +39,6 @@
 import org.apache.commons.scxml.io.SCXMLParser;
 import org.apache.commons.scxml.model.CustomAction;
 import org.apache.commons.scxml.model.SCXML;
-import org.apache.commons.scxml.model.State;
 import org.apache.commons.scxml.model.TransitionTarget;
 import org.xml.sax.ErrorHandler;
 /**
@@ -273,13 +272,13 @@
 
     public static void assertPostTriggerState(SCXMLExecutor exec,
             TriggerEvent triggerEvent, String expectedStateId) {
-        Set currentStates = fireEvent(exec, triggerEvent);
+        Set<TransitionTarget> currentStates = fireEvent(exec, triggerEvent);
         Assert.assertEquals("Expected 1 simple (leaf) state with id '"
             + expectedStateId + "' on firing event " + triggerEvent
             + " but found " + currentStates.size() + " states instead.",
             1, currentStates.size());
-        Assert.assertEquals(expectedStateId, ((State)currentStates.iterator().
-            next()).getId());
+        Assert.assertEquals(expectedStateId, currentStates.iterator().
+            next().getId());
     }
 
     public static void assertPostTriggerStates(SCXMLExecutor exec,
@@ -294,7 +293,7 @@
             + " on firing event " + triggerEvent + " but found "
             + currentStates.size() + " states instead.",
             n, currentStates.size());
-        List expectedStateIdList = Arrays.asList(expectedStateIds);
+        List<String> expectedStateIdList = Arrays.asList(expectedStateIds);
         for (TransitionTarget tt : currentStates) {
             String stateId = tt.getId();
             if(!expectedStateIdList.remove(stateId)) {

Modified: commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/TieBreakerTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/TieBreakerTest.java?rev=651785&r1=651784&r2=651785&view=diff
==============================================================================
--- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/TieBreakerTest.java
(original)
+++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/TieBreakerTest.java
Fri Apr 25 18:56:55 2008
@@ -24,7 +24,6 @@
 import junit.framework.TestSuite;
 import junit.textui.TestRunner;
 
-import org.apache.commons.scxml.model.State;
 import org.apache.commons.scxml.model.TransitionTarget;
 /**
  * Unit tests for testing conflict resolution amongst multiple transitions
@@ -90,46 +89,40 @@
     public void testTieBreaker01() {
         exec = SCXMLTestHelper.getExecutor(tiebreaker01);
         assertNotNull(exec);
-        Set currentStates = exec.getCurrentStatus().getStates();
+        Set<TransitionTarget> currentStates = exec.getCurrentStatus().getStates();
         assertEquals(1, currentStates.size());
-        assertEquals("ten", ((State)currentStates.iterator().
-            next()).getId());
+        assertEquals("ten", currentStates.iterator().next().getId());
         currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
         assertEquals(1, currentStates.size());
-        assertEquals("twenty", ((State)currentStates.iterator().
-            next()).getId());
+        assertEquals("twenty", currentStates.iterator().next().getId());
     }
 
     public void testTieBreaker02() {
         exec = SCXMLTestHelper.getExecutor(tiebreaker02);
         assertNotNull(exec);
-        Set currentStates = exec.getCurrentStatus().getStates();
+        Set<TransitionTarget> currentStates = exec.getCurrentStatus().getStates();
         assertEquals(1, currentStates.size());
-        assertEquals("eleven", ((State)currentStates.iterator().
-            next()).getId());
+        assertEquals("eleven", currentStates.iterator().next().getId());
         currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
         assertEquals(1, currentStates.size());
-        assertEquals("thirty", ((State)currentStates.iterator().
-            next()).getId());
+        assertEquals("thirty", currentStates.iterator().next().getId());
     }
 
     public void testTieBreaker03() {
         exec = SCXMLTestHelper.getExecutor(tiebreaker03);
         assertNotNull(exec);
-        Set currentStates = exec.getCurrentStatus().getStates();
+        Set<TransitionTarget> currentStates = exec.getCurrentStatus().getStates();
         assertEquals(1, currentStates.size());
-        assertEquals("eleven", ((State)currentStates.iterator().
-            next()).getId());
+        assertEquals("eleven", currentStates.iterator().next().getId());
         currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
         assertEquals(1, currentStates.size());
-        assertEquals("forty", ((State)currentStates.iterator().
-            next()).getId());
+        assertEquals("forty", currentStates.iterator().next().getId());
     }
 
     public void testTieBreaker04() {
         exec = SCXMLTestHelper.getExecutor(tiebreaker04);
         assertNotNull(exec);
-        Set currentStates = SCXMLTestHelper.fireEvent(exec, "event_2");
+        Set<TransitionTarget> currentStates = SCXMLTestHelper.fireEvent(exec, "event_2");
         assertEquals(1, currentStates.size());
         currentStates = SCXMLTestHelper.fireEvent(exec, "event_1");
         assertEquals(1, currentStates.size());
@@ -157,7 +150,7 @@
     public void testTieBreaker06() {
         exec = SCXMLTestHelper.getExecutor(SCXMLTestHelper.parse(tiebreaker06));
         assertNotNull(exec);
-        Set currentStates = exec.getCurrentStatus().getStates();
+        Set<TransitionTarget> currentStates = exec.getCurrentStatus().getStates();
         assertEquals(1, currentStates.size());
     }
 

Modified: commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/WildcardTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/WildcardTest.java?rev=651785&r1=651784&r2=651785&view=diff
==============================================================================
--- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/WildcardTest.java
(original)
+++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/WildcardTest.java
Fri Apr 25 18:56:55 2008
@@ -24,7 +24,7 @@
 import junit.framework.TestSuite;
 import junit.textui.TestRunner;
 
-import org.apache.commons.scxml.model.State;
+import org.apache.commons.scxml.model.TransitionTarget;
 /**
  * Unit tests {@link org.apache.commons.scxml.SCXMLExecutor}.
  * Testing wildcard event matching (*)
@@ -72,15 +72,13 @@
     	exec = SCXMLTestHelper.getExecutor(wildcard01);
         assertNotNull(exec);
         try {
-            Set currentStates = exec.getCurrentStatus().getStates();
+            Set<TransitionTarget> currentStates = exec.getCurrentStatus().getStates();
             assertEquals(1, currentStates.size());
-            assertEquals("state1", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("state1", 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());
+            assertEquals("state4", currentStates.iterator().next().getId());
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -90,10 +88,9 @@
         exec = SCXMLTestHelper.getExecutor(SCXMLTestHelper.parse(wildcard02));
         assertNotNull(exec);
         try {
-            Set currentStates = exec.getCurrentStatus().getStates();
+            Set<TransitionTarget> currentStates = exec.getCurrentStatus().getStates();
             assertEquals(1, currentStates.size());
-            assertEquals("state2", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("state2", currentStates.iterator().next().getId());
         } catch (Exception e) {
             fail(e.getMessage());
         }

Modified: commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/WizardsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/WizardsTest.java?rev=651785&r1=651784&r2=651785&view=diff
==============================================================================
--- commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/WizardsTest.java
(original)
+++ commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/WizardsTest.java
Fri Apr 25 18:56:55 2008
@@ -31,7 +31,8 @@
 import org.apache.commons.scxml.env.jexl.JexlContext;
 import org.apache.commons.scxml.env.jexl.JexlEvaluator;
 import org.apache.commons.scxml.model.SCXML;
-import org.apache.commons.scxml.model.State;
+import org.apache.commons.scxml.model.TransitionTarget;
+import org.w3c.dom.Node;
 /**
  * Unit tests {@link org.apache.commons.scxml.SCXMLExecutor}.
  */
@@ -78,28 +79,23 @@
     	exec = SCXMLTestHelper.getExecutor(wizard01);
         assertNotNull(exec);
         try {
-            Set currentStates = exec.getCurrentStatus().getStates();
+            Set<TransitionTarget> currentStates = exec.getCurrentStatus().getStates();
             assertEquals(1, currentStates.size());
-            assertEquals("state1", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("state1", currentStates.iterator().next().getId());
             exec = SCXMLTestHelper.testExecutorSerializability(exec);
             currentStates = SCXMLTestHelper.fireEvent(exec, "event2");
             assertEquals(1, currentStates.size());
-            assertEquals("state2", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("state2", currentStates.iterator().next().getId());
             currentStates = SCXMLTestHelper.fireEvent(exec, "event4");
             assertEquals(1, currentStates.size());
-            assertEquals("state4", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("state4", currentStates.iterator().next().getId());
             currentStates = SCXMLTestHelper.fireEvent(exec, "event3");
             assertEquals(1, currentStates.size());
-            assertEquals("state3", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("state3", 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());
+            assertEquals("state3", currentStates.iterator().next().getId());
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -114,15 +110,13 @@
         try {
             // If you change this, you must also change
             // the TestEventDispatcher
-            Set currentStates = exec.getCurrentStatus().getStates();
+            Set<TransitionTarget> currentStates = exec.getCurrentStatus().getStates();
             assertEquals(1, currentStates.size());
-            assertEquals("state2", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("state2", currentStates.iterator().next().getId());
             exec = SCXMLTestHelper.testExecutorSerializability(exec);
             currentStates = SCXMLTestHelper.fireEvent(exec, "event4");
             assertEquals(1, currentStates.size());
-            assertEquals("state4", ((State)currentStates.iterator().
-                next()).getId());
+            assertEquals("state4", currentStates.iterator().next().getId());
         } catch (Exception e) {
             fail(e.getMessage());
         }
@@ -133,8 +127,8 @@
         // If you change this, you must also change testWizard02Sample()
         int callback = 0;
         public void send(String sendId, String target, String targetType,
-                String event, Map params, Object hints, long delay,
-                List externalNodes) {
+                String event, Map<String, Object> params, Object hints, long delay,
+                List<Node> externalNodes) {
             int i = ((Integer) params.get("aValue")).intValue();
             switch (callback) {
                 case 0:



Mime
View raw message