Author: rahul
Date: Tue Jan 15 15:21:49 2008
New Revision: 612305

URL: http://svn.apache.org/viewvc?rev=612305&view=rev
Log:
Use for-each to reduce clutter.

Modified:
    
commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/TieBreakerTest.java

Modified: 
commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/TieBreakerTest.java
URL: 
http://svn.apache.org/viewvc/commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/TieBreakerTest.java?rev=612305&r1=612304&r2=612305&view=diff
==============================================================================
--- 
commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/TieBreakerTest.java
 (original)
+++ 
commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/TieBreakerTest.java
 Tue Jan 15 15:21:49 2008
@@ -17,7 +17,6 @@
 package org.apache.commons.scxml;
 
 import java.net.URL;
-import java.util.Iterator;
 import java.util.Set;
 
 import junit.framework.Test;
@@ -26,6 +25,7 @@
 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
  * within the [EMAIL PROTECTED] org.apache.commons.scxml.SCXMLExecutor}'s 
default
@@ -138,21 +138,17 @@
     public void testTieBreaker05() {
         exec = SCXMLTestHelper.getExecutor(tiebreaker05);
         assertNotNull(exec);
-        Set currentStates = exec.getCurrentStatus().getStates();
+        Set<TransitionTarget> currentStates = 
exec.getCurrentStatus().getStates();
         assertEquals(3, currentStates.size());
-        String id = ((State) currentStates.iterator().next()).getId();
-        Iterator iter = currentStates.iterator();
-        while (iter.hasNext()) {
-            id = ((State) iter.next()).getId();
+        for (TransitionTarget tt : currentStates) {
+            String id = tt.getId();
             assertTrue(id.equals("s11") || id.equals("s212")
                 || id.equals("s2111"));
         }
         currentStates = SCXMLTestHelper.fireEvent(exec, "event1");
         assertEquals(3, currentStates.size());
-        id = ((State) currentStates.iterator().next()).getId();
-        iter = currentStates.iterator();
-        while (iter.hasNext()) {
-            id = ((State) iter.next()).getId();
+        for (TransitionTarget tt : currentStates) {
+            String id = tt.getId();
             assertTrue(id.equals("s12") || id.equals("s212")
                 || id.equals("s2112"));
         }


Reply via email to