tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dblev...@apache.org
Subject svn commit: r1023096 - /openejb/branches/openejb-3.1.x/container/openejb-core/src/test/java/org/apache/openejb/core/stateless/StatelessPoolStatsTest.java
Date Fri, 15 Oct 2010 20:15:31 GMT
Author: dblevins
Date: Fri Oct 15 20:15:31 2010
New Revision: 1023096

URL: http://svn.apache.org/viewvc?rev=1023096&view=rev
Log:
Added assertEquals for lists and maps so we can more easily see what doesn't compare

Modified:
    openejb/branches/openejb-3.1.x/container/openejb-core/src/test/java/org/apache/openejb/core/stateless/StatelessPoolStatsTest.java

Modified: openejb/branches/openejb-3.1.x/container/openejb-core/src/test/java/org/apache/openejb/core/stateless/StatelessPoolStatsTest.java
URL: http://svn.apache.org/viewvc/openejb/branches/openejb-3.1.x/container/openejb-core/src/test/java/org/apache/openejb/core/stateless/StatelessPoolStatsTest.java?rev=1023096&r1=1023095&r2=1023096&view=diff
==============================================================================
--- openejb/branches/openejb-3.1.x/container/openejb-core/src/test/java/org/apache/openejb/core/stateless/StatelessPoolStatsTest.java
(original)
+++ openejb/branches/openejb-3.1.x/container/openejb-core/src/test/java/org/apache/openejb/core/stateless/StatelessPoolStatsTest.java
Fri Oct 15 20:15:31 2010
@@ -50,6 +50,7 @@ import java.lang.management.ManagementFa
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Properties;
@@ -175,7 +176,31 @@ public class StatelessPoolStatsTest exte
         List<MBeanOperationInfo> actualOperations = new ArrayList<MBeanOperationInfo>();
         actualOperations.addAll(Arrays.asList(poolMBeanInfo.getOperations()));
         assertEquals(expectedOperations, actualOperations);
+    }
+
+    public static void assertEquals(List<?> expectedList, List<?> actualList)
{
+        final Iterator<?> expected = expectedList.iterator();
+        final Iterator<?> actual = actualList.iterator();
+
+        while(expected.hasNext() && actual.hasNext()) {
+            assertEquals(expected.next(), actual.next());
+        }
+
+        assertEquals(expected.hasNext(), actual.hasNext());
+    }
+
+    public static void assertEquals(Map<?,?> expectedMap, Map<?,?> actualMap)
{
+        final Iterator<? extends Map.Entry<?, ?>> expectedIt = expectedMap.entrySet().iterator();
+        final Iterator<? extends Map.Entry<?, ?>> actualIt = actualMap.entrySet().iterator();
+
+        while (expectedIt.hasNext() && actualIt.hasNext()) {
+            final Map.Entry<?, ?> expected = expectedIt.next();
+            final Map.Entry<?, ?> actual = actualIt.next();
+            assertEquals("key", expected.getKey(), actual.getKey());
+            assertEquals(expected.getKey().toString(), expected.getValue(), actual.getValue());
+        }
 
+        assertEquals(expectedIt.hasNext(), actualIt.hasNext());
     }
 
     /**



Mime
View raw message