title: Mockito - Argument Captor not capturing and no interactions
body: <p>I'm working on some old code that does not handle exceptions very well.  One test I'm writing, stubs a method that throws an exception, which I need to confirm is the correct exception.  The only way to test this exception that I can see, is to capture the argument when it is being logged and compare the strings.</p>
  
  <p>When I run this I get:</p>
  
  <p>Wanted but not invoked: logger.error(Capturing argument)</p>
  
  <p>Actually there were zero interactions with this mock</p>
  
  <pre><code>@Test
  public void testRunCipherThrowsException() throws Exception
  {
      final Logger logger = mock(Logger.class);
      ArgumentCaptor&lt;Logger&gt; argument = ArgumentCaptor.forClass(Logger.class);
  
      when(cipher.doSomething(any(byte[].class))).thenThrow(new IllegalBlockSizeException("Bad block size"));
      Mockito.verify(logger).error(argument.capture());
  
      _task.run();
  
      assertEquals("The execution failed.  Details: Bad block size", argument.getValue().getName());
  }
  </code></pre>
  
  <p>Here is a snippet from the class I am testing - in debug I am hitting that line of code every time. </p>
  
  <pre><code>try
  {
  
  final byte[] result = cipher.doSomething(testData);
  
  catch (final Exception ex)
      {
          _consequtiveFailures++;
          _logger.error("The execution failed.  Details: " + ex.getMessage(), ex);
      }
  </code></pre>
  
  <p>I've tried to arrange the test a few different ways thinking the verify might not be getting setup correctly.  I have also tried a few different ways of setting of the mock Logger object.  It is my first time using argument captor, so hopefully I'm just missing something obvious.  </p>