Author: rahul
Date: Mon Jan 26 21:45:25 2009
New Revision: 737870

URL: http://svn.apache.org/viewvc?rev=737870&view=rev
Log:
Adding a test utility method.

Modified:
    
commons/proper/scxml/branches/J6/src/test/java/org/apache/commons/scxml/SCXMLTestHelper.java

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=737870&r1=737869&r2=737870&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
 Mon Jan 26 21:45:25 2009
@@ -168,6 +168,16 @@
         return exec.getSCInstance().lookupContext(tt);
     }
 
+    public static void assertState(SCXMLExecutor exec,
+            String expectedStateId) throws Exception {
+        Set<TransitionTarget> currentStates = 
exec.getCurrentStatus().getStates();
+        Assert.assertEquals("Expected 1 simple (leaf) state with id '"
+            + expectedStateId + "' but found " + currentStates.size() + " 
states instead.",
+            1, currentStates.size());
+        Assert.assertEquals(expectedStateId, currentStates.iterator().
+            next().getId());
+    }
+
     public static Set<TransitionTarget> fireEvent(SCXMLExecutor exec, String 
name) throws Exception {
         TriggerEvent[] evts = {new TriggerEvent(name,
                 TriggerEvent.SIGNAL_EVENT, null)};


Reply via email to