public class BeanTest extends TestCase {
private BeanRunner beanRunner = new BeanRunner();
public void testTestBean() throws Exception {
SimpleBean bean = new SimpleBean();
beanRunner.testBean(bean);
}
}
In order to call a setter, Bean Runner needs to have an instance of the value being set. If a no-arg constuctor exists, it will be used to create an instance. If not, an instance needs to be provided.
BeanRunner beanRunner = new BeanRunner(); Calendar cal = Calendar.getInstance(); beanRunner.addTestValue(Calendar.class, cal);
Sometimes it is desireable to exclude properties from being tested. This might include setters that have side effects or do range checking on values.
public void testExcludeProperty() throws Exception {
beanRunner.excludeProperty("intValue");
beanRunner.testBean(bean);
}