Class BeanTestChecker

Object
org.anchoranalysis.test.experiment.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 Summary

    Modifier and Type Method Description
    static <T extends org.anchoranalysis.bean.AnchorBean<?>>
    T
    check​(T bean)
    Checks if a bean has all necessary items, throwing a run-time exception if it does not.
    static <T extends org.anchoranalysis.bean.initializable.InitializableBean<?,​ P>,​ P extends org.anchoranalysis.bean.initializable.parameters.BeanInitialization>
    T
    checkAndInit​(T bean, P initialization, org.anchoranalysis.core.log.Logger logger)
    Checks if a bean has all necessary items as with check(T) and also initializes the bean.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • check

      public static <T extends org.anchoranalysis.bean.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 org.anchoranalysis.bean.initializable.InitializableBean<?,​ P>,​ P extends org.anchoranalysis.bean.initializable.parameters.BeanInitialization> T checkAndInit​(T bean, P initialization, org.anchoranalysis.core.log.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.