maspack.util
Class TestSupport

java.lang.Object
  extended bymaspack.util.TestSupport

public class TestSupport
extends java.lang.Object


Constructor Summary
TestSupport()
           
 
Method Summary
static void checkExceptions(java.lang.Exception eActual, java.lang.Exception eExpected)
          Checks to see if an actual exception equals an expected exception.
static boolean epsilonEquals(double[] a1, double[] a2, double tol)
          Returns true if the double arrys a1 and a2 are equal within a presecribed tolerance, or if they are both null.
static boolean equals(boolean[] a1, boolean[] a2)
          Returns true if the boolean arrys a1 and a2 are equal, or if they are both null.
static boolean equals(java.util.Collection c1, java.util.Collection c2)
          Returns true if the contents of two collections are the same, or if they are both null.
static boolean equals(double[] a1, double[] a2)
          Returns true if the double arrys a1 and a2 are equal, or if they are both null.
static boolean equals(java.lang.Exception e1, java.lang.Exception e2)
          Returns true if two exceptions have the same class type and error message, or if they are both null.
static boolean equals(int[] a1, int[] a2)
          Returns true if the integer arrys a1 and a2 are equal, or if they are both null.
static boolean equals(java.lang.String s1, java.lang.String s2)
          Returns true if the Strings s1 and s2 are equal, or if they are both null.
static java.lang.String exceptionName(java.lang.Exception e)
          Returns a string giving the class name and message for a particular exception.
static java.lang.String toString(boolean[] a)
          Converts an array of booleans into a String
static java.lang.String toString(double[] a)
          Converts an array of doubles into a String
static java.lang.String toString(int[] a)
          Converts an array of integers into a String
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TestSupport

public TestSupport()
Method Detail

equals

public static boolean equals(boolean[] a1,
                             boolean[] a2)
Returns true if the boolean arrys a1 and a2 are equal, or if they are both null.

Parameters:
a1 - first array
a2 - second array
Returns:
true if the arrays are equal

equals

public static boolean equals(int[] a1,
                             int[] a2)
Returns true if the integer arrys a1 and a2 are equal, or if they are both null.

Parameters:
a1 - first array
a2 - second array
Returns:
true if the arrays are equal

equals

public static boolean equals(double[] a1,
                             double[] a2)
Returns true if the double arrys a1 and a2 are equal, or if they are both null.

Parameters:
a1 - first array
a2 - second array
Returns:
true if the arrays are equal

equals

public static boolean equals(java.lang.String s1,
                             java.lang.String s2)
Returns true if the Strings s1 and s2 are equal, or if they are both null.

Parameters:
s1 - first string
s2 - second string
Returns:
true if the strings are equal

epsilonEquals

public static boolean epsilonEquals(double[] a1,
                                    double[] a2,
                                    double tol)
Returns true if the double arrys a1 and a2 are equal within a presecribed tolerance, or if they are both null.

Parameters:
a1 - first array
a2 - second array
tol - tolerance
Returns:
true if the arrays are equal

equals

public static boolean equals(java.lang.Exception e1,
                             java.lang.Exception e2)
Returns true if two exceptions have the same class type and error message, or if they are both null.

Parameters:
e1 - first exception
e2 - second exception
Returns:
true if both exceptions are equal

equals

public static boolean equals(java.util.Collection c1,
                             java.util.Collection c2)
Returns true if the contents of two collections are the same, or if they are both null. The contents are considered equal if they have the same number of elements and if corresponding elements are themselves equal.

Parameters:
c1 - first collection
c2 - second collection
Returns:
true if both collections are equal

exceptionName

public static java.lang.String exceptionName(java.lang.Exception e)
Returns a string giving the class name and message for a particular exception.


checkExceptions

public static void checkExceptions(java.lang.Exception eActual,
                                   java.lang.Exception eExpected)
                            throws TestException
Checks to see if an actual exception equals an expected exception. If they do not, then throw a TestException.

Parameters:
eActual - exception that actually occurred.
eExpected - exception that we are expecting.
Throws:
TestException

toString

public static java.lang.String toString(boolean[] a)
Converts an array of booleans into a String

Parameters:
a - boolean array
Returns:
string representation

toString

public static java.lang.String toString(int[] a)
Converts an array of integers into a String

Parameters:
a - integer array
Returns:
string representation

toString

public static java.lang.String toString(double[] a)
Converts an array of doubles into a String

Parameters:
a - double array
Returns:
string representation