title: Mockito: define mock behaviour
body: <p>I am trying to test a class, which depends on external service. This external service amends objects, passed to it:</p>
  
  <pre><code>public void methodF(Op op) {
  
      ...
  
      // op.operationId == 0
  
      externalService.registerOp(op);
  
      // op.operationId == 123456L
  
      if (op.getOperationId() == 0) {
          throw new CustomException();
      }
  
  }
  </code></pre>
  
  <p>If I mock external service it doesn't amend op and whole method, which is being tested, fails with exception.</p>
  
  <p>How do I define mock behaviour to fake amending an operation?</p>