org.tranche.util
Class AssertionUtil

java.lang.Object
  extended by org.tranche.util.AssertionUtil

public class AssertionUtil
extends java.lang.Object

Utility methods for common assertions.

Author:
Bryan Smith - bryanesmith@gmail.com

Constructor Summary
AssertionUtil()
           
 
Method Summary
static void assertBytesDifferent(byte[] b1, byte[] b2)
          Assert that two byte arrays are of same size and have same contents.
static void assertBytesSame(byte[] b1, byte[] b2)
          Assert that two byte arrays are of same size and have same contents.
static void assertNoDuplicateObjects(java.lang.Object[] arg)
          Looks for any duplicates and throws an exception if found.
static void assertNoNullValues(byte[] bytes)
           
static void assertNoNullValues(byte[][] bytes)
           
static void assertNoNullValues(java.lang.Object o)
          Throws exception if any null values found.
static void assertNoNullValues(java.lang.Object[] arg)
          Throws exception if any null values found.
static void assertNoNullValues(java.lang.Object[][] arg)
          Throws exception if any null values found.
static void assertSame(java.io.File file1, java.io.File file2)
          Assert that two files or directories are the same, which means:
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AssertionUtil

public AssertionUtil()
Method Detail

assertNoNullValues

public static void assertNoNullValues(java.lang.Object o)
                               throws java.lang.Exception

Throws exception if any null values found.

Parameters:
o -
Throws:
java.lang.Exception

assertNoNullValues

public static void assertNoNullValues(java.lang.Object[] arg)
                               throws java.lang.Exception

Throws exception if any null values found.

Parameters:
arg -
Throws:
java.lang.Exception

assertNoNullValues

public static void assertNoNullValues(byte[] bytes)
                               throws java.lang.Exception
Parameters:
bytes -
Throws:
java.lang.Exception

assertNoNullValues

public static void assertNoNullValues(byte[][] bytes)
                               throws java.lang.Exception
Parameters:
bytes -
Throws:
java.lang.Exception

assertNoNullValues

public static void assertNoNullValues(java.lang.Object[][] arg)
                               throws java.lang.Exception

Throws exception if any null values found.

Parameters:
arg -
Throws:
java.lang.Exception

assertNoDuplicateObjects

public static void assertNoDuplicateObjects(java.lang.Object[] arg)
                                     throws java.lang.Exception

Looks for any duplicates and throws an exception if found.

Parameters:
arg -
Throws:
java.lang.Exception

assertBytesSame

public static void assertBytesSame(byte[] b1,
                                   byte[] b2)
                            throws java.lang.Exception

Assert that two byte arrays are of same size and have same contents.

Parameters:
b1 -
b2 -
Throws:
java.lang.Exception

assertBytesDifferent

public static void assertBytesDifferent(byte[] b1,
                                        byte[] b2)
                                 throws java.lang.Exception

Assert that two byte arrays are of same size and have same contents.

Parameters:
b1 -
b2 -
Throws:
java.lang.Exception

assertSame

public static void assertSame(java.io.File file1,
                              java.io.File file2)
                       throws java.io.IOException,
                              java.lang.Exception

Assert that two files or directories are the same, which means:

Note this does NOT assert that the files or directories have the same nextName. This allows the use of TempFileUtil, which must flexibly nextName temporary files and directories.

However, if passing two directories, all contents (subdirectories and files) must have the same nextName.

Parameters:
file1 -
file2 -
Throws:
java.io.IOException
java.lang.Exception


This code is free for use both commercially and non-commercially as stated in the project's license