Mockito Java doAnswer
<p>This won't compile. I get an <code>UnfinishedStubbingException</code>. I've read the Mockito api and other questions on this site and I think that my syntax shouldn't be wrong, but it fails at <code>doAnswer(new Answer() {</code>, so I figure it has to be wrong, but I don't know where. Thanks.</p>

<pre><code>doAnswer(new Answer() {
            @Override
            public Object answer(InvocationOnMock invocation) throws Throwable {
                Object[] args = invocation.getArguments();
                ((CrestronNioSocketHandler.NioEventReceiver) args[0]).onDataReceived(new byte[wantedNumber]);
                return null;
            }
        }).when(mockedChannel.read(any(ByteBuffer.class)));
</code></pre>