title: Mockito ArgumentCaptor with lambda (Chronicle Queue)
body: <p>I have implemented following Chronicle Queue and for this I want to write unit test case. How do I capture ArgumentCaptor arguments while using lambda. I want to get writeBuffer in test case to verify the data. </p>
  
  <pre><code>public class Persister  {
  
  public Persister(SingleChronicleQueue chronicle) {
      this.chronicle = chronicle;
  }
  public void write(int outBufferOffset) throws IOException {
         ExcerptAppender appender = chronicle.acquireAppender();
         appender.writeBytes(b -&gt; {
                 b.writeInt(outBufferOffset);                    
                 b.write(writeBuffer, 0 , outBufferOffset);
         });}
  }
  </code></pre>
  
  <p>Test case:</p>
  
  <pre><code>@Mock
  SingleChronicleQueue chronicle;
  @Mock
  ExcerptAppender appender;
  @Captor
  ArgumentCaptor&lt;WriteBytesMarshallable&gt; argumentCaptorLambda;
  
  Persister persister = new Persister();
  @Test
  public void shouldPersistByteMessage() throws IOException {
      persister.write(MESSAGEBYTES);
  
      verify(appender).writeBytes(argumentCaptorLambda.capture());
      WriteBytesMarshallable lastValue =  argumentCaptorLambda.getValue();
  
      //final byte[] persistedBytes = ?? how to get writeBuffer here ??
      //assertThat(readPersistedMessage(persistedBytes), is(MESSAGE));
  }
  </code></pre>
  
  <p>Thanks</p>