[jboss-cvs] JBoss Messaging SVN: r4662 - trunk/tests/src/org/jboss/messaging/tests/util.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Mon Jul 7 17:38:51 EDT 2008


Author: clebert.suconic at jboss.com
Date: 2008-07-07 17:38:51 -0400 (Mon, 07 Jul 2008)
New Revision: 4662

Modified:
   trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java
Log:
Tweak!

Modified: trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java
===================================================================
--- trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java	2008-07-07 21:09:47 UTC (rev 4661)
+++ trunk/tests/src/org/jboss/messaging/tests/util/UnitTestCase.java	2008-07-07 21:38:51 UTC (rev 4662)
@@ -58,6 +58,12 @@
  */
 public class UnitTestCase extends TestCase
 {
+   // Constants -----------------------------------------------------
+   
+   // Attributes ----------------------------------------------------
+   
+   // Static --------------------------------------------------------
+   
    public static String dumpBytes(byte[] bytes)
    {
       StringBuffer buff = new StringBuffer();
@@ -79,6 +85,77 @@
       return buff.toString();      
    }
    
+   public static void assertEqualsByteArrays(byte[] expected, byte[] actual)
+   {
+      assertEquals(expected.length, actual.length);
+      for (int i = 0; i < expected.length; i++)
+      {
+         assertEquals("byte at index " + i, expected[i], actual[i]);
+      }
+   }
+
+   public static void assertEqualsByteArrays(int length, byte[] expected, byte[] actual)
+   {
+      // we check only for the given length (the arrays might be
+      // larger)
+      assertTrue(expected.length >= length);
+      assertTrue(actual.length >= length);
+      for (int i = 0; i < length; i++)
+      {
+         assertEquals("byte at index " + i, expected[i], actual[i]);
+      }
+   }
+
+   public static void assertSameXids(List<Xid> expected, List<Xid> actual)
+   {
+      assertNotNull(expected);
+      assertNotNull(actual);
+      assertEquals(expected.size(), actual.size());
+   
+      for (int i = 0; i < expected.size(); i++)
+      {
+         Xid expectedXid = expected.get(i);
+         Xid actualXid = actual.get(i);
+         UnitTestCase.assertEqualsByteArrays(expectedXid.getBranchQualifier(), actualXid
+               .getBranchQualifier());
+         assertEquals(expectedXid.getFormatId(), actualXid.getFormatId());
+         UnitTestCase.assertEqualsByteArrays(expectedXid.getGlobalTransactionId(), actualXid
+               .getGlobalTransactionId());
+      }
+   }
+
+   
+   public static MessagingException messagingExceptionMatch(final int errorID)
+   {
+      EasyMock.reportMatcher(new IArgumentMatcher()
+      {
+
+         public void appendTo(StringBuffer buffer)
+         {
+            buffer.append(errorID);
+         }
+
+         public boolean matches(Object argument)
+         {
+            MessagingException ex = (MessagingException) argument;
+            
+            return ex.getCode() == errorID;
+         }
+         
+      });
+      
+      return null;
+   }
+   
+   // Constructors --------------------------------------------------
+   
+   // Public --------------------------------------------------------
+   
+   // Package protected ---------------------------------------------
+   
+   // Protected -----------------------------------------------------
+   
+
    protected boolean deleteDirectory(File directory)
    {
       if (directory.isDirectory())
@@ -199,68 +276,10 @@
       return ((size / alignment) + (size % alignment != 0 ? 1 : 0)) * alignment;
    }
 
-   public static void assertEqualsByteArrays(byte[] expected, byte[] actual)
-   {
-      assertEquals(expected.length, actual.length);
-      for (int i = 0; i < expected.length; i++)
-      {
-         assertEquals("byte at index " + i, expected[i], actual[i]);
-      }
-   }
-
-   public static void assertEqualsByteArrays(int length, byte[] expected, byte[] actual)
-   {
-      // we check only for the given length (the arrays might be
-      // larger)
-      assertTrue(expected.length >= length);
-      assertTrue(actual.length >= length);
-      for (int i = 0; i < length; i++)
-      {
-         assertEquals("byte at index " + i, expected[i], actual[i]);
-      }
-   }
-
-   public static void assertSameXids(List<Xid> expected, List<Xid> actual)
-   {
-      assertNotNull(expected);
-      assertNotNull(actual);
-      assertEquals(expected.size(), actual.size());
+   // Private -------------------------------------------------------
    
-      for (int i = 0; i < expected.size(); i++)
-      {
-         Xid expectedXid = expected.get(i);
-         Xid actualXid = actual.get(i);
-         UnitTestCase.assertEqualsByteArrays(expectedXid.getBranchQualifier(), actualXid
-               .getBranchQualifier());
-         assertEquals(expectedXid.getFormatId(), actualXid.getFormatId());
-         UnitTestCase.assertEqualsByteArrays(expectedXid.getGlobalTransactionId(), actualXid
-               .getGlobalTransactionId());
-      }
-   }
-
+   // Inner classes -------------------------------------------------
    
-   public static MessagingException messagingExceptionMatch(final int errorID)
-   {
-      EasyMock.reportMatcher(new IArgumentMatcher()
-      {
-
-         public void appendTo(StringBuffer buffer)
-         {
-            buffer.append(errorID);
-         }
-
-         public boolean matches(Object argument)
-         {
-            MessagingException ex = (MessagingException) argument;
-            
-            return ex.getCode() == errorID;
-         }
-         
-      });
-      
-      return null;
-   }
-   
    public static class DirectExecutorService extends AbstractExecutorService
    {
       public boolean awaitTermination(long timeout, TimeUnit unit)




More information about the jboss-cvs-commits mailing list