use of org.mockito.internal.verification.AtMost in project pravega by pravega.
the class CommandEncoderTest method verifyFlush.
public void verifyFlush(CommandEncoder commandEncoder, UnpooledByteBufAllocator allocator, Object command) throws Exception {
ChannelHandlerContext context = mock(ChannelHandlerContext.class);
Mockito.when(context.alloc()).thenReturn(allocator);
Mockito.when(context.executor()).thenReturn(Mockito.mock(EventExecutor.class));
commandEncoder.write(context, command, null);
verify(context).alloc();
verify(context).write(Mockito.any(), Mockito.any());
verify(context).flush();
// Irrelevant
verify(context, new AtMost(10)).executor();
// Irrelevant
verify(context, new AtMost(10)).channel();
verifyNoMoreInteractions(context);
}
use of org.mockito.internal.verification.AtMost in project pravega by pravega.
the class CommandEncoderTest method verifyNoFlush.
public void verifyNoFlush(CommandEncoder commandEncoder, UnpooledByteBufAllocator allocator, Object command) throws Exception {
ChannelHandlerContext context = mock(ChannelHandlerContext.class);
Mockito.when(context.alloc()).thenReturn(allocator);
Mockito.when(context.executor()).thenReturn(Mockito.mock(EventExecutor.class));
commandEncoder.write(context, command, null);
verify(context).alloc();
verify(context).write(Mockito.any(), Mockito.any());
// Irrelevant
verify(context, new AtMost(10)).executor();
// Irrelevant
verify(context, new AtMost(10)).channel();
verifyNoMoreInteractions(context);
}
Aggregations