net.sf.molae.pipe.test
Class SetTest<B extends Set<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>
Direct Known Subclasses:
SortedSetTest

public class SetTest<B extends Set<E>,E>
extends CollectionTest<B,E>

Test methods to check the contract of set implementing classes.


Constructor Summary
protected SetTest(B testObject)
          Creates a new test with the specified candidate.
 
Method Summary
 void assertConsistency()
          Checks consistency of all reading set methods.
protected  void checkAddAll(String message, List<E> l)
          This implementation uses Set.equals(Object).
static
<E> SetTest<Set<E>,E>
getInstance(Set<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.
protected  void performSimpleCycle()
          Performs a test cycle of methods that take single elements as argument (Set.remove(Object) and Set.add(Object)).
 
Methods inherited from class net.sf.molae.pipe.test.CollectionTest
assertAddProhibited, assertEqualContent, assertEqualSequence, assertImmutability, assertValidArray, checkConsistency, getInstance, getTestValue, performBulkCycle, performIntegerTest, 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

SetTest

protected SetTest(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> SetTest<Set<E>,E> getInstance(Set<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.

checkAddAll

protected void checkAddAll(String message,
                           List<E> l)
This implementation uses Set.equals(Object).

Overrides:
checkAddAll in class CollectionTest<B extends Set<E>,E>
Parameters:
message - the message to be displayed if the assertion fails
l - the list to compare
Throws:
AssertionFailedError - if the specified list is not equal to the test object.

assertConsistency

public void assertConsistency()
Checks consistency of all reading set methods.

Overrides:
assertConsistency in class CollectionTest<B extends Set<E>,E>
Throws:
AssertionFailedError - if the set contract is broken by the test object.

performSimpleCycle

protected void performSimpleCycle()
Performs a test cycle of methods that take single elements as argument (Set.remove(Object) and Set.add(Object)).

Throws:
AssertionFailedError - if the set contract is broken by the specified set.
UnsupportedOperationException - if any of the called methods is not implemented.

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 CollectionTest<B extends Set<E>,E>
Throws:
AssertionFailedError - if the set contract is broken by the specified set.
UnsupportedOperationException - if any of the called methods is not implemented.