1 Reply Latest reply on Dec 24, 2013 2:19 AM by Jean-Louis Pasturel

    Clarification needed about AT INVOKE Location and DO statement.

    Jean-Louis Pasturel Newbie

      For example, if I write this rule :

      RULE mock javax.mail.Transport.send
              CLASS mypackage.MyClass
              METHOD sendAMessage
              # All sendAMessage methods are triggered
              AT INVOKE javax.mail.Transport.send ALL
              IF TRUE
              DO return
      ENDRULE


      javax.mail.Transport.send and mypackage.MyClass.sendAMessage both return void.

       

      Questions :

      The DO return statement is applied on method mypackage.MyClass.sendAMessage and not on the method javax.mail.Transport.send.

      Am I right ?

      The goal is to skip only  the invoked method.

       

      If I am right, the only way to play code after the invoked method, is to replicate it, in  a custom helper, and ends the DO statement by a return.

      Am I right, also?

       

      Ce message a été modifié par : Jean-Louis Pasturel oops, shame on me! It is not the best way to solve the problem to skip the method. Solution is : RULE mock javax.mail.Transport.send         CLASS javax.mail.Transport         METHOD send         AT ENTRY           # Controlling the Tree call         IF callerEquals("mypackage.MyClass.sendAMessage", true,true)         DO return ENDRULE Sorry for the noise