net.sf.molae.bean.test
Class BeanStructureTest

java.lang.Object
  |
  +--junit.framework.Assert
        |
        +--net.sf.molae.pipe.test.ObjectTest
              |
              +--net.sf.molae.bean.test.BeanStructureTest

public class BeanStructureTest
extends ObjectTest

Test methods to check the contract of bean structure implementing classes.

Since:
1.1

Constructor Summary
protected BeanStructureTest(BeanStructure testObject)
          Creates a new test with the specified candidate.
 
Method Summary
 void assertConsistency()
          Checks consistency of all reading BeanStructure methods.
protected  void checkConsistency()
          This method is called at the start of the test cycle and after each modification of the test object.
static BeanStructureTest getInstance(BeanStructure testObject)
          Creates a new instance of this class with the specified testObject as test object.
 void performCycle()
          Performs a test cycle.
 void performCycle(String name1, String name2)
          Performs a test cycle.
 void testGetProperty(String name)
          Calls BeanStructure.getProperty(java.lang.String) with the specified name.
 
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

BeanStructureTest

protected BeanStructureTest(BeanStructure 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 BeanStructureTest getInstance(BeanStructure 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

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

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.

testGetProperty

public void testGetProperty(String name)
Calls BeanStructure.getProperty(java.lang.String) with the specified name.
Parameters:
name - name of a new property
Throws:
AssertionFailedError - if the bean structure contract is broken by the tested bean structure.

performCycle

public void performCycle(String name1,
                         String name2)
Performs a test cycle. During the test the tested bean structure is set to read only.
Parameters:
name1 - a test key
name2 - a test key
Throws:
AssertionFailedError - if the test object does not pass the test.

performCycle

public void performCycle()
Performs a test cycle. During the test the tested bean structure is set to read only.
Throws:
AssertionFailedError - if the test object does not pass the test.