net.sf.molae.pipe.test
Class SortedSetTest<B extends SortedSet<E>,E>

java.lang.Object
  extended by org.junit.Assert
      extended by net.sf.molae.pipe.test.ObjectTest<B>
          extended by net.sf.molae.pipe.test.CollectionTest<B,E>
              extended by net.sf.molae.pipe.test.SetTest<B,E>
                  extended by net.sf.molae.pipe.test.SortedSetTest<B,E>

public class SortedSetTest<B extends SortedSet<E>,E>
extends SetTest<B,E>

Test methods to check the contract of SortedSet implementing classes.


Constructor Summary
protected SortedSetTest(B testObject)
          Creates a new test with the specified candidate.
 
Method Summary
 void addHeadSetTest(E toElement)
          Adds a head set test to the list of sub set tests that are performed simultaneously.
 void addSubSetTest(E fromElement, E toElement)
          Adds a subset test to the list of sub set tests that are performed simultaneously.
 void addTailSetTest(E fromElement)
          Adds a tail set test to the list of sub set tests that are performed simultaneously.
 void assertConsistency()
          Checks consistency of reading SortedSet methods.
protected  void assertValidArray(String message, Object[] a)
          Checks if the specified array is a valid result of the toArray() or toArray(Object[]) operation, respectively.
static
<E> SortedSetTest<SortedSet<E>,E>
getInstance(SortedSet<E> testObject)
          Creates a new instance of this class with the specified testObject as test object.
 void performCycle()
          Performs a test cycle that uses modifying methods but is expected to leave the test object in an equal state as at the start - if everything works fine.
 void performIntegerTest()
          Deprecated. Use setIntegerTestValues(net.sf.molae.pipe.test.SortedSetTest) and CollectionTest.performValuesTest() instead.
static void setIntegerTestValues(SortedSetTest<?,? super Integer> test)
          Sets default values for the test values.
 
Methods inherited from class net.sf.molae.pipe.test.SetTest
checkAddAll, getInstance, performSimpleCycle
 
Methods inherited from class net.sf.molae.pipe.test.CollectionTest
assertAddProhibited, assertEqualContent, assertEqualSequence, assertImmutability, checkConsistency, getInstance, getTestValue, performBulkCycle, performValuesTest, setIntegerTestValues, setTestValues
 
Methods inherited from class net.sf.molae.pipe.test.ObjectTest
assertFalse, assertTestValuesSet, getTestObject, setTestValuesSet, toString
 
Methods inherited from class org.junit.Assert
assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertArrayEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertThat, assertThat, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SortedSetTest

protected SortedSetTest(B testObject)
Creates a new test with the specified candidate.

Parameters:
testObject - the candidate of the test
Throws:
NullPointerException - if the specified test objects is null.
Method Detail

getInstance

public static final <E> SortedSetTest<SortedSet<E>,E> getInstance(SortedSet<E> testObject)
Creates a new instance of this class with the specified testObject as test object.

Parameters:
testObject - the candidate of the test
Returns:
an instance of this class with the specified testObject as test object.
Throws:
NullPointerException - if the specified test objects is null.

assertValidArray

protected void assertValidArray(String message,
                                Object[] a)

Checks if the specified array is a valid result of the toArray() or toArray(Object[]) operation, respectively.

This implementation uses CollectionTest.assertEqualSequence(String,Iterator,Iterator).

Overrides:
assertValidArray in class CollectionTest<B extends SortedSet<E>,E>
Parameters:
message - the message to be displayed if the assertion fails
a - the result of a toArray() operation.
Throws:
AssertionFailedError - if the specified array is not a valid result.

assertConsistency

public void assertConsistency()
Checks consistency of reading SortedSet methods.

Overrides:
assertConsistency in class SetTest<B extends SortedSet<E>,E>
Throws:
AssertionFailedError - if the SortedSet contract is broken by the specified sorted set.

performCycle

public void performCycle()
Performs a test cycle that uses modifying methods but is expected to leave the test object in an equal state as at the start - if everything works fine.

Overrides:
performCycle in class SetTest<B extends SortedSet<E>,E>
Throws:
AssertionFailedError - if the test object does not pass the test.

setIntegerTestValues

public static void setIntegerTestValues(SortedSetTest<?,? super Integer> test)
Sets default values for the test values.


performIntegerTest

public void performIntegerTest()
Deprecated. Use setIntegerTestValues(net.sf.molae.pipe.test.SortedSetTest) and CollectionTest.performValuesTest() instead.

Method to test sorted set implementations that support integers.

Overrides:
performIntegerTest in class CollectionTest<B extends SortedSet<E>,E>

addSubSetTest

public void addSubSetTest(E fromElement,
                          E toElement)
Adds a subset test to the list of sub set tests that are performed simultaneously.

Parameters:
fromElement - low endpoint (inclusive) of the subSet
toElement - high endpoint (exclusive) of the subSet

addHeadSetTest

public void addHeadSetTest(E toElement)
Adds a head set test to the list of sub set tests that are performed simultaneously.

Parameters:
toElement - high endpoint (exclusive) of the headSet.

addTailSetTest

public void addTailSetTest(E fromElement)
Adds a tail set test to the list of sub set tests that are performed simultaneously.

Parameters:
fromElement - low endpoint (inclusive) of the tailSet.