commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ra...@apache.org
Subject svn commit: r610578 - in /commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml: BuiltinTest.java SCInstanceTest.java SCXMLExecutorTest.java SCXMLHelperTest.java TriggerEventTest.java
Date Wed, 09 Jan 2008 21:36:52 GMT
Author: rahul
Date: Wed Jan  9 13:36:17 2008
New Revision: 610578

URL: http://svn.apache.org/viewvc?rev=610578&view=rev
Log:
Improve type safety in tests.

Modified:
    commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/BuiltinTest.java
    commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/SCInstanceTest.java
    commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
    commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/SCXMLHelperTest.java
    commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/TriggerEventTest.java

Modified: commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/BuiltinTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/BuiltinTest.java?rev=610578&r1=610577&r2=610578&view=diff
==============================================================================
--- commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/BuiltinTest.java
(original)
+++ commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/BuiltinTest.java
Wed Jan  9 13:36:17 2008
@@ -42,7 +42,7 @@
     }
     
     public void testIsMemberEmptySet() {
-        Set set = new HashSet();
+        Set<TransitionTarget> set = new HashSet<TransitionTarget>();
         
         assertFalse(Builtin.isMember(set, "on"));
     }
@@ -51,7 +51,7 @@
         TransitionTarget state = new State();
         state.setId("off");
         
-        Set set = new HashSet();
+        Set<TransitionTarget> set = new HashSet<TransitionTarget>();
         set.add(state);
         
         assertFalse(Builtin.isMember(set, "on"));
@@ -61,7 +61,7 @@
         TransitionTarget state = new State();
         state.setId("on");
         
-        Set set = new HashSet();
+        Set<TransitionTarget> set = new HashSet<TransitionTarget>();
         set.add(state);
         
         assertTrue(Builtin.isMember(set, "on"));

Modified: commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/SCInstanceTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/SCInstanceTest.java?rev=610578&r1=610577&r2=610578&view=diff
==============================================================================
--- commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/SCInstanceTest.java
(original)
+++ commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/SCInstanceTest.java
Wed Jan  9 13:36:17 2008
@@ -131,17 +131,19 @@
         History history = new History();
         history.setId("1");
         
-        Set configuration = new HashSet();
-        configuration.add("value1");
-        configuration.add("value2");
+        Set<TransitionTarget> configuration = new HashSet<TransitionTarget>();
+        TransitionTarget tt1 = new State();
+        TransitionTarget tt2 = new State();
+        configuration.add(tt1);
+        configuration.add(tt2);
         
         instance.setLastConfiguration(history, configuration);  
         
         Set returnConfiguration = instance.getLastConfiguration(history);
         
         assertEquals(2, returnConfiguration.size());
-        assertTrue(returnConfiguration.contains("value1"));
-        assertTrue(returnConfiguration.contains("value2"));
+        assertTrue(returnConfiguration.contains(tt1));
+        assertTrue(returnConfiguration.contains(tt2));
     }
     
     public void testIsEmpty() {
@@ -152,9 +154,9 @@
         History history = new History();
         history.setId("1");
         
-        Set configuration = new HashSet();
-        configuration.add("value1");
-        configuration.add("value2");
+        Set<TransitionTarget> configuration = new HashSet<TransitionTarget>();
+        TransitionTarget tt1 = new State();
+        configuration.add(tt1);
         
         instance.setLastConfiguration(history, configuration);  
 
@@ -165,9 +167,9 @@
         History history = new History();
         history.setId("1");
         
-        Set configuration = new HashSet();
-        configuration.add("value1");
-        configuration.add("value2");
+        Set<TransitionTarget> configuration = new HashSet<TransitionTarget>();
+        TransitionTarget tt1 = new State();
+        configuration.add(tt1);
         
         instance.setLastConfiguration(history, configuration);  
 

Modified: commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java?rev=610578&r1=610577&r2=610578&view=diff
==============================================================================
--- commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
(original)
+++ commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/SCXMLExecutorTest.java
Wed Jan  9 13:36:17 2008
@@ -203,7 +203,7 @@
         try {
             Set currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
             assertEquals(3, currentStates.size());
-            Set expected = new HashSet();
+            Set<String> expected = new HashSet<String>();
             expected.add("twenty_one_2");
             expected.add("twenty_two_2");
             expected.add("twenty_three_2");
@@ -228,7 +228,7 @@
         try {
             Set currentStates = SCXMLTestHelper.fireEvent(exec, "ten.done");
             assertEquals(3, currentStates.size());
-            Set expected = new HashSet();
+            Set<String> expected = new HashSet<String>();
             expected.add("twenty_one_1");
             expected.add("twenty_two_1");
             expected.add("twenty_three_1");

Modified: commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/SCXMLHelperTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/SCXMLHelperTest.java?rev=610578&r1=610577&r2=610578&view=diff
==============================================================================
--- commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/SCXMLHelperTest.java
(original)
+++ commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/SCXMLHelperTest.java
Wed Jan  9 13:36:17 2008
@@ -92,20 +92,20 @@
     }
     
     public void testGetAncestorClosureEmptySet() {
-        Set states = new HashSet();
+        Set<TransitionTarget> states = new HashSet<TransitionTarget>();
         
-        Set returnValue = SCXMLHelper.getAncestorClosure(states, new HashSet());
+        Set returnValue = SCXMLHelper.getAncestorClosure(states, new HashSet<TransitionTarget>());
         
         assertEquals(0, returnValue.size());
     }
     
     public void testGetAncestorClosureUpperBoundNotNullAndContains() {
-        Set states = new HashSet();
+        Set<TransitionTarget> states = new HashSet<TransitionTarget>();
         TransitionTarget state = new State();
         state.setId("1");
         states.add(state);
         
-        Set upperBounds = new HashSet();
+        Set<TransitionTarget> upperBounds = new HashSet<TransitionTarget>();
         upperBounds.add(state);
         
         Set returnValue = SCXMLHelper.getAncestorClosure(states, upperBounds);
@@ -115,13 +115,13 @@
     }
     
     public void testGetAncestorClosureContainsParent() {
-        Set states = new HashSet();
+        Set<TransitionTarget> states = new HashSet<TransitionTarget>();
         TransitionTarget state = new State();
         state.setId("1");
         state.setParent(state);
         states.add(state);
         
-        Set upperBounds = new HashSet();
+        Set<TransitionTarget> upperBounds = new HashSet<TransitionTarget>();
         
         Set returnValue = SCXMLHelper.getAncestorClosure(states, upperBounds);
         
@@ -130,13 +130,13 @@
     }
     
     public void testIsLegalConfigNoStates() {
-        Set states = new HashSet();
+        Set<TransitionTarget> states = new HashSet<TransitionTarget>();
         
         assertTrue(SCXMLHelper.isLegalConfig(states, new SimpleErrorReporter()));
     }
     
     public void testIsLegalConfigInvalidParallel() {
-        Set states = new HashSet();
+        Set<TransitionTarget> states = new HashSet<TransitionTarget>();
         Parallel parallel = new Parallel();
 
         Parallel parent = new Parallel();
@@ -162,7 +162,7 @@
     }
     
     public void testIsLegalConfigMultipleTopLevel() {
-        Set states = new HashSet();
+        Set<TransitionTarget> states = new HashSet<TransitionTarget>();
 
         State state1 = new State();
         state1.setId("1");
@@ -180,7 +180,7 @@
     }
     
     public void testIsLegalConfigMultipleStatesActive() {
-        Set states = new HashSet();
+        Set<TransitionTarget> states = new HashSet<TransitionTarget>();
 
         State state1 = new State();
         state1.setId("1");

Modified: commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/TriggerEventTest.java
URL: http://svn.apache.org/viewvc/commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/TriggerEventTest.java?rev=610578&r1=610577&r2=610578&view=diff
==============================================================================
--- commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/TriggerEventTest.java
(original)
+++ commons/proper/scxml/branches/J5/src/test/java/org/apache/commons/scxml/TriggerEventTest.java
Wed Jan  9 13:36:17 2008
@@ -42,7 +42,7 @@
     }
 
     // Test data
-    private Map payloadData;
+    private Map<String, String> payloadData;
     private Object payload1, payload2;
     private TriggerEvent te1, te2, te3, te4, te5, te6, te7;
 
@@ -50,7 +50,7 @@
      * Set up instance variables required by this test case.
      */
     public void setUp() {
-        payloadData = new HashMap();
+        payloadData = new HashMap<String, String>();
         payloadData.put("property1", "value1");
         payload1 = payloadData;
         payload2 = new Object();



Mime
View raw message