@Override public Void answer(InvocationOnMock invocation) throws Throwable { Consumer consumer = (Consumer) invocation.getArguments()[0]; Iterator<EncodedImage> iterator = mResults.iterator(); while (iterator.hasNext()) { EncodedImage result = iterator.next(); consumer.onNewResult(result, !iterator.hasNext()); } return null; }
@Override public Void answer(InvocationOnMock invocation) throws Throwable { Consumer consumer = (Consumer) invocation.getArguments()[0]; consumer.onNewResult(mResult, true); return null; }