title: Using mockito captor to capture the argument sent to a method
body: <p>I would like to capture the argument inputMessage in the readInternal() of the CustomMessageConverter class when client submits a message. client object here is not a mock object.</p>
  
  <pre><code>@Component
  public class CustomMessageConverter extends AbstractHttpMessageConverter&lt;Object&gt; {
  
  ...
  
      @Override
      protected Object readInternal(final Class&lt;? extends Object&gt; clazz, final HttpInputMessage inputMessage) throws IOException,
              HttpMessageNotReadableException {
  
              ...do something here...
      }
  ...
  }
  </code></pre>
  
  <p>In AbstractHttpMessageConverter class:</p>
  
  <pre><code>@Override
  public final T read(Class&lt;? extends T&gt; clazz, HttpInputMessage inputMessage) throws IOException {
      return readInternal(clazz, inputMessage);
  }
  </code></pre>
  
  <p>So, I wrote a mockito class to capture it. </p>
  
  <p><em>But, it is still going to the regular converter class. Could you suggest what I am doing wrong?</em>  </p>
  
  <pre><code>@Mock
  CustomMessageConverter mockMessageConverter;
  
  @Captor
  private ArgumentCaptor&lt;HttpInputMessage&gt; inputMessage;
  
  
  @Test
  public void test() {
      when(mockMessageConverter.read(CustomMessage.class, inputMessage.capture())).thenReturn(null);
      client.submitMessage(Message);
      verify(mockMessageConverter, times(1));
      Object actual = customConverter.read(CustomMessage.class, inputMessage.getValue());
  }
  </code></pre>