Class BeanTestChecker
Object
BeanTestChecker
Checks to see if a bean has been misconfigured, when created manually in tests (thereby skipping
the usual checks during the BeanXML loading process).
Additionally wraps the exceptions thrown in AnchorFriendlyRuntimeException
to make
tests more readable, rather than having too many different checked exception types in the test
code, for non-operational failures.
- Author:
- Owen Feehan
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends AnchorBean<?>>
Tcheck
(T bean) Checks if a bean has all necessary items, throwing a run-time exception if it does not.static <T extends InitializableBean<?,
P>, P extends BeanInitialization>
TcheckAndInit
(T bean, P initialization, Logger logger) Checks if a bean has all necessary items as withcheck(T)
and also initializes the bean.
-
Method Details
-
check
Checks if a bean has all necessary items, throwing a run-time exception if it does not.- Type Parameters:
T
- bean-type- Parameters:
bean
- bean to check- Returns:
- the bean that was checked.
-
checkAndInit
public static <T extends InitializableBean<?,P>, T checkAndInitP extends BeanInitialization> (T bean, P initialization, Logger logger) Checks if a bean has all necessary items as withcheck(T)
and also initializes the bean.- Type Parameters:
T
- bean-typeP
- initialization-parameters-type accepted by the bean- Parameters:
bean
- the bean to check and initialize.initialization
- initialization-parameters.logger
- the logger.- Returns:
- the bean that was checked and initialized.
-