|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jbeantester.framework.JBeanTester
The JavaBeanTester
class performs all testing.
A developer would instantiate an instance of this class and then use
one (or more) of the test
methods and then compare the
JBeanTestResults returned to the expected results.
Field Summary | |
protected Logger |
cat
A Logger to use in this object and all derivatives. |
Constructor Summary | |
JBeanTester()
Default constructor. |
Method Summary | |
protected Object |
getParamToUse(Class paramType)
Obtain an object to use to satisfy this parameter. |
JBeanTestResults |
testJBeanConstructor(Class clazz,
String[] params)
Test that the specified constructors function properly. |
JBeanTestResults |
testJBeanProperties(Class clazz)
This method is used to test the properties of a default consttucted instance of Class es conforming to the JavaBean
Specification. |
JBeanTestResults |
testJBeanProperties(Object obj)
This method is used to test the properties of Objects
conforming to the JavaBean Specification. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected final Logger cat
Constructor Detail |
public JBeanTester()
Method Detail |
protected Object getParamToUse(Class paramType)
paramType
- the type of the object to be instantiated.
paramType
to pass as a parameter
to this method.public JBeanTestResults testJBeanProperties(Class clazz)
This method is used to test the properties of a default consttucted
instance of Class
es conforming to the JavaBean
Specification.
This method constructs an instance of the specified Class
and passes it to the overloaded version of this method accepting an
Object
. Please see the documentation for that method.
If any Exception
or Error
condition is
encountered while examining the methods, the condition is logged and that
property is ignored.
Note that no JUnit Assertions are made within this method. All results
are returned for processing within the testCase
.
Note that this object is not thread safe.
clazz
- the class to be instantiated and tested; error on
null
.
public JBeanTestResults testJBeanProperties(Object obj)
This method is used to test the properties of Objects
conforming to the JavaBean Specification.
An attempt is made to match up mutators (setters) accepting one parameter
with appropriate accessors (getters). For those pairs found, an attempt
is made at constructing input parameters. Each mutator is called with
the appropriate data followed by each accessor to check that the return
value matches.
Input data is constructed with sequentially different values. For non-primitive objects or their wrappers (those items found in java.lang) an attempt is made to construct an instance using the default constructor (no parameters). If this fails, the property is skipped.
Mutators must begin with 'set' while accessors must begin with 'get'
unless the parameter is a boolean
(primitive) in which case
it may also begin with 'is'.
If any Exception
or Error
condition is
encountered while examining the methods, the condition is logged and that
property is ignored.
Note that no JUnit Assertions are made within this method. All results
are returned for processing within the testCase
.
Note that this object is not thread safe.
obj
- the object to be tested; error on null
.
public JBeanTestResults testJBeanConstructor(Class clazz, String[] params)
Test that the specified constructors function properly.
Test that the constructor exists and that the getters for the specified
properties return the expected values. If the the specified constructor
does not exist, JBeanTestResults.NO_SUCH_CONSTRUCTOR
will be
returned.
clazz
- the class to be tested.params
- the names of the properties which comprise the constructor
to be tested.
JBeanTestResults.NO_SUCH_CONSTRUCTOR
if no such
constructor exists.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |