1 Reply Latest reply on Jul 13, 2009 7:47 PM by lucio piccoli

    injection of ActionHandler instance for unit test

    lucio piccoli Newbie

      hi all

      i would like to unit test a ActionHandler, but need to mock some methods. However i am unable to find a mechanism to inject the mocked instance into my processContext.

      any help appreciated.

      -lp

        • 1. Re: injection of ActionHandler instance for unit test
          lucio piccoli Newbie

          perhaps my question was rather restrictive.

          i will rephrase my question.

          Q. essentially how does one test a ActionHandler?

          I looked at the src and the only tests i found seem to tests for the Action events.

          I was looking for something like

          ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
           "<process-definition>" +
           " <node name='n'>" +
           " <event type='node-enter'>" +
           " <action name='a' class='MyHandler'/>" +
           " </event>" +
           " </node>" +
           "</process-definition>");
          
          MyHandler MyHandlerInstance = new MyHandler();
          
          ...mock up
          
          processDefinition.setAction("a", MyHandlerInstance),
          
          ...do test
          
          

          How do u guys test your ActionHandler without doing a full integration test?

          any help is most appreciated.

          -lp