Class Mocks


  • public class Mocks
    extends java.lang.Object
    Registry for mock objects.

    Usage: Mocks.register("myMock", myMock);

    This class lets you register mock objects that will then be used by the MockElResolver. It binds a map of mock objects to ThreadLocal. This way, the mocks can be set up independent of how the process engine configuration is built.

    Author:
    Nils Preusker - n.preusker@gmail.com
    • Constructor Summary

      Constructors 
      Constructor Description
      Mocks()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object get​(java.lang.Object key)
      This method returns the mock object registered under the provided key or null if there is no object for the provided key.
      static java.util.Map<java.lang.String,​java.lang.Object> getMocks()  
      static void register​(java.lang.String key, java.lang.Object value)
      This method lets you register a mock object.
      static void reset()
      This method resets the internal map of mock objects.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Mocks

        public Mocks()
    • Method Detail

      • getMocks

        public static java.util.Map<java.lang.String,​java.lang.Object> getMocks()
      • register

        public static void register​(java.lang.String key,
                                    java.lang.Object value)
        This method lets you register a mock object. Make sure to register the MockExpressionManager with your process engine configuration.
        Parameters:
        key - the key under which the mock object will be registered
        value - the mock object
      • get

        public static java.lang.Object get​(java.lang.Object key)
        This method returns the mock object registered under the provided key or null if there is no object for the provided key.
        Parameters:
        key - the key of the requested object
        Returns:
        the mock object registered under the provided key or null if there is no object for the provided key
      • reset

        public static void reset()
        This method resets the internal map of mock objects.