net.sf.molae.pipe.test
Class CubeTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--net.sf.molae.pipe.test.ObjectTest
              |
              +--net.sf.molae.pipe.test.CubeTest
Direct Known Subclasses:
CubeTest.ProjectionTest

public class CubeTest
extends ObjectTest

Test methods to check the contract of cube implementing classes.

Since:
1.1

Inner Class Summary
static class CubeTest.ProjectionTest
          Test methods to check the contract of projections.
 
Constructor Summary
protected CubeTest(Cube testObject)
          Creates a new test with the specified candidate.
 
Method Summary
 void assertConsistency()
          Checks consistency of all reading cube methods.
protected  void assertConsistency(List key)
          Checks consistency of all reading cube methods regarding the element at the specified key.
protected  void checkConsistency()
          This method is called at the start of the test cycle and after each modification of the test object.
protected  void checkConsistency(List key)
          This method is called at the start of the test cycle and after each modification of the element at the specified key.
static CubeTest getInstance(Cube testObject)
          Creates a new instance of this class with the specified testObject as test object.
 void performCycle()
          Performs a test cycle.
protected  void performCycle(List key)
          Puts the specified key/value pair and restores the old value.
 void performIntegerTest()
          Method to test cube implementations that support integers.
 void setTestValue(Object testValue)
          Sets the test value to the specified value.
 
Methods inherited from class net.sf.molae.pipe.test.ObjectTest
assertFalse, getTestObject, toString
 
Methods inherited from class junit.framework.Assert
assert, assert, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertNotNull, assertNotNull, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CubeTest

protected CubeTest(Cube 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 CubeTest getInstance(Cube 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.

assertConsistency

protected void assertConsistency(List key)
Checks consistency of all reading cube methods regarding the element at the specified key.
Parameters:
key - key of the element to check
Throws:
AssertionFailedError - if the cube contract is broken by the tested cube.

assertConsistency

public void assertConsistency()
Checks consistency of all reading cube methods.
Overrides:
assertConsistency in class ObjectTest
Throws:
AssertionFailedError - if the cube contract is broken by the tested cube.

checkConsistency

protected void checkConsistency(List key)
This method is called at the start of the test cycle and after each modification of the element at the specified key. This implementation calls assertConsistency(List).
Parameters:
key - key of the element to check
Throws:
AssertionFailedError - if the test object is not consistent.

checkConsistency

protected void checkConsistency()
This method is called at the start of the test cycle and after each modification of the test object. This implementation calls assertConsistency().
Throws:
AssertionFailedError - if the test object is not consistent.

setTestValue

public void setTestValue(Object testValue)
Sets the test value to the specified value. The test value is used for testing the put method.
Parameters:
testValue - new value of the test value.

performCycle

protected void performCycle(List key)
Puts the specified key/value pair and restores the old value.
Parameters:
key - key of the cube entry to be modified
Throws:
AssertionFailedError - if the cube contract is broken by the tested cube.

performCycle

public void performCycle()
Performs a test cycle.
Throws:
AssertionFailedError - if the cube contract is broken by the tested cube.

performIntegerTest

public void performIntegerTest()
Method to test cube implementations that support integers. Fills the test object with three entries and runs tests with it.
Throws:
AssertionFailedError - if the test object does not pass the test.