unc.cdva.testutils
Class TestingUtil

java.lang.Object
  extended by unc.cdva.testutils.TestingUtil

public class TestingUtil
extends java.lang.Object

Provides utility methods hopefully helpful for testing.


Method Summary
static boolean assertUnique(java.lang.Object[] testArray)
          Tests to see if all of the elements of an array are all mutually unique, ie: that no two elements have the same value.
static int count(java.lang.String token, java.lang.String searchedString)
          Counts the number of occurances of a token in a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

count

public static int count(java.lang.String token,
                        java.lang.String searchedString)
Counts the number of occurances of a token in a string. The matching of tokens may or may not be case sensitive, the case sensitivity is the same as the String.substring method.

Parameters:
token - The token to be counted.
searchedString - The string which may contain some number of occurrances of the token.
Returns:
Returns the number of unique substrings in searchedString matching token.
Throws:
java.lang.RuntimeException - if token parameter (1st param) is equal to the empty string.

assertUnique

public static boolean assertUnique(java.lang.Object[] testArray)
Tests to see if all of the elements of an array are all mutually unique, ie: that no two elements have the same value.

Parameters:
testArray - The array who's elements we'll test.
Returns:
False if two or more elements are equal, true otherwise.