|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnl.ivonet.beanunit.Asserter
nl.ivonet.beanunit.ConstructorImmutableBeanAsserter
public class ConstructorImmutableBeanAsserter
Test utility for testing beans that are immutable after construction. Complete construction must be done by a constructor for the tests in this class to work.
Construction of the immutable object is done by reflection and providing default types with values. This class tries to assert that behavior of the bean after construction is valid. There should be no write methods in the class under test. All attributes should have read methods. All read methods (getters) should return the default value provided for the return type. Attributes can be excluded by providing their string representation as a parameter to the method.
| Method Summary | ||
|---|---|---|
static
|
assertEqualsHashCode(java.lang.Class<T> classUnderTest)
Tests all the flows of the overridden equals and hashCode methods of a class. |
|
static
|
assertGettersOnConstructorImmutableObject(java.lang.Class<T> classUnderTest,
java.lang.String... excludedProperties)
Asserts that the Getters return the default value for the return type of the getter. |
|
| Methods inherited from class nl.ivonet.beanunit.Asserter |
|---|
deregisterType, registerTypeAndDefaultArgument, resetToDefaultTypes |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static <T> void assertGettersOnConstructorImmutableObject(java.lang.Class<T> classUnderTest,
java.lang.String... excludedProperties)
T - the type of the class under test.classUnderTest - the Class to testexcludedProperties - property to exclude from testing if some of the rules are not nicely upheld :-)public static <T> void assertEqualsHashCode(java.lang.Class<T> classUnderTest)
T - the type of the class to testclassUnderTest - the implementation.class
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||