|
|||||||||
| 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.BuilderBeanAsserter
public class BuilderBeanAsserter
Asserts "simple" beans that are constructed using the "Builder" pattern as documented by Joshua Bloch ("Effective Java" - Second Edition).
The Beans constructed this way are after construction immutable or at least that is the intention for using the builder. See http://www.javapractices.com/topic/TopicAction.do?Id=29 for good reasons to make objects immutable. Construction can be done in stages by "building" the object but after the final build we can only read the object. The following assumptions are asserted: All properties that can be set on the builder should be reflected by the read method on the class to be build. All Builders should have a build() method (convention) By preference one should call the Builder class "Builder" but this is not mandatory.
| Constructor Summary | |
|---|---|
BuilderBeanAsserter()
|
|
| Method Summary | ||
|---|---|---|
static
|
assertBuildObjectGetterBehavior(java.lang.Class<T> classUnderTest)
Tests a Bean created with a Builder. |
|
static
|
assertBuildObjectGetterBehavior(java.lang.Class<T> classUnderTest,
java.lang.Class<B> builderUnderTest)
Tests a Bean created with a Builder. |
|
static
|
assertBuildObjectGetterBehavior(java.lang.Class<T> classUnderTest,
java.lang.Class<B> builderUnderTest,
java.lang.String... exclusionProperties)
Tests a Bean created with a Builder. |
|
static
|
assertBuildObjectGetterBehavior(java.lang.Class<T> classUnderTest,
java.lang.Class<B> builderUnderTest,
java.lang.String buildMethodName,
java.util.List<java.lang.String> excludedBuilderMethods,
java.util.List<java.lang.String> excludedClassProperties)
Tests a bean created by a builder. |
|
static
|
assertBuildObjectGetterBehavior(java.lang.Class<T> classUnderTest,
java.util.List<java.lang.String> exclusionMethodNames)
Tests a Bean created with a Builder. |
|
static
|
assertBuildObjectGetterBehavior(java.lang.Class<T> classUnderTest,
java.lang.String... exclusionProperties)
Tests a Bean created with a Builder. |
|
static
|
assertEqualsHashCode(java.lang.Class<T> classUnderTest,
java.lang.Class<B> builderUnderTest,
java.lang.String buildMethod,
java.util.List<java.lang.String> excludedProperties)
Tests all the flows of the overridden equals and hashCode methods of a class. |
|
static
|
assertEqualsHashCode(java.lang.Class<T> classUnderTest,
java.lang.String... excludedProperties)
Tests all the flows of the overridden equals and hashCode methods of a class. |
|
| 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 |
| Constructor Detail |
|---|
public BuilderBeanAsserter()
| Method Detail |
|---|
public static <T,B> void assertBuildObjectGetterBehavior(java.lang.Class<T> classUnderTest,
java.lang.Class<B> builderUnderTest,
java.lang.String buildMethodName,
java.util.List<java.lang.String> excludedBuilderMethods,
java.util.List<java.lang.String> excludedClassProperties)
T - the type of the classUnderTestB - the type of the builderclassUnderTest - the class to testbuilderUnderTest - the builder that creates the classUnderTestbuildMethodName - the name of the method that builds the classUnderTestexcludedBuilderMethods - properties to exclude from the test in the builderexcludedClassProperties - properties to exclude from the test in de class under test
public static <T> void assertEqualsHashCode(java.lang.Class<T> classUnderTest,
java.lang.String... excludedProperties)
T - the type of the class to testclassUnderTest - the implementation.classexcludedProperties - string representation of all the properties excluded from the equals test , e.g. "firstName"
public static <T,B> void assertEqualsHashCode(java.lang.Class<T> classUnderTest,
java.lang.Class<B> builderUnderTest,
java.lang.String buildMethod,
java.util.List<java.lang.String> excludedProperties)
T - the type of the class to testclassUnderTest - the implementation.classbuilderUnderTest - the Builder classbuildMethod - the string name of the build methodexcludedProperties - string representation of all the properties excluded from the equals test , e.g. "firstName"public static <T> void assertBuildObjectGetterBehavior(java.lang.Class<T> classUnderTest)
T - the type of the classUnderTestclassUnderTest - the class to test
public static <T> void assertBuildObjectGetterBehavior(java.lang.Class<T> classUnderTest,
java.lang.String... exclusionProperties)
T - the type of the classUnderTestclassUnderTest - the class to testexclusionProperties - class under test properties to exclude from the test
public static <T,B> void assertBuildObjectGetterBehavior(java.lang.Class<T> classUnderTest,
java.lang.Class<B> builderUnderTest)
T - the type of the classUnderTestB - the type of the builderclassUnderTest - the class to testbuilderUnderTest - the builder that creates the classUnderTest
public static <T,B> void assertBuildObjectGetterBehavior(java.lang.Class<T> classUnderTest,
java.lang.Class<B> builderUnderTest,
java.lang.String... exclusionProperties)
T - the type of the classUnderTestB - the type of the builderclassUnderTest - the class to testbuilderUnderTest - the builder that creates the classUnderTestexclusionProperties - the properties to ignore on the class under test.
public static <T> void assertBuildObjectGetterBehavior(java.lang.Class<T> classUnderTest,
java.util.List<java.lang.String> exclusionMethodNames)
T - the type of the classUnderTestclassUnderTest - the class to testexclusionMethodNames - the properties to ignore on the builder under test.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||