Class BeanTestChecker

Object
BeanTestChecker

public class BeanTestChecker extends Object
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 Details

    • check

      public static <T extends AnchorBean<?>> T check(T bean)
      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>, P extends BeanInitialization> T checkAndInit(T bean, P initialization, Logger logger)
      Checks if a bean has all necessary items as with check(T) and also initializes the bean.
      Type Parameters:
      T - bean-type
      P - 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.