Beispiel #1
0
 public BpmMessage read() {
   try {
     return messageQueue.poll(100, TimeUnit.MILLISECONDS);
   } catch (InterruptedException e) {
     throw new RuntimeException(e);
   }
 }
  @Test
  public void shouldPollForTransactedMessagesFromTheInboxBlockingDeque() {
    BlockingDeque<TransactedMessage> inbox = mock(BlockingDeque.class);
    ExecutorService executorService = mock(ExecutorService.class);
    ClientSocketWrapper socket = mock(ClientSocketWrapper.class);

    when(inbox.poll()).thenReturn(new TransactedMessage(0, 0, 1000L));

    PerformanceReporter performanceReporter =
        new PerformanceReporter(inbox, 5, executorService, socket);
    performanceReporter.run();

    verify(inbox, atLeast(5)).poll();
  }