@Test @Ignore public void shouldSkipLostMessages() throws Exception { List<LogMessage> listWithMissedMessages = new ArrayList<>(orderedMessages); listWithMissedMessages.remove(75); listWithMissedMessages.remove(50); listWithMissedMessages.remove(25); for (LogMessage logMessage : listWithMissedMessages) { logMessagesHandler.onMessageReceived(logMessage); } for (LogMessage logMessage : orderedMessages) { final int index = orderedMessages.indexOf(logMessage); if (index == 25 || index == 50 || index == 75) { verify(builderConsolePresenter, never()).print(logMessage.text); } else { verify(builderConsolePresenter, timeout(5000).times(1)).print(logMessage.text); } } }
@Override protected void onMessageReceived(LogMessage result) { if (result.num == lastPrintedMessageNum + 1) { flushTimer.cancel(); printLine(result); } else if (result.num > lastPrintedMessageNum) { postponedMessages.put(result.num, result); } printNextPostponedMessages(); flushTimer.schedule(5000); }
LogMessagesHandler extends SubscriptionHandler<LogMessage> { @Override protected void onMessageReceived(LogMessage result) { if (result.num == lastPrintedMessageNum + 1) { flushTimer.cancel(); printLine(result); } else if (result.num > lastPrintedMessageNum) { postponedMessages.put(result.num, result); } printNextPostponedMessages(); flushTimer.schedule(5000); } }
LogMessagesHandler extends SubscriptionHandler<LogMessage> { @Override protected void onMessageReceived(LogMessage result) { if (result.num == lastPrintedMessageNum + 1) { flushTimer.cancel(); printLine(result); } else if (result.num > lastPrintedMessageNum) { postponedMessages.put(result.num, result); } printNextPostponedMessages(); flushTimer.schedule(5000); } LogMessagesHandler(BuildTaskDescriptor buildTaskDescriptor, BuilderConsolePresenter console, MessageBus messageBus); }
LogMessagesHandler extends SubscriptionHandler<LogMessage> { @Override protected void onMessageReceived(LogMessage result) { if (result.num == lastPrintedMessageNum + 1) { flushTimer.cancel(); printLine(result); } else if (result.num > lastPrintedMessageNum) { postponedMessages.put(result.num, result); } printNextPostponedMessages(); flushTimer.schedule(5000); } LogMessagesHandler(BuildTaskDescriptor buildTaskDescriptor, BuilderConsolePresenter console, MessageBus messageBus);  }
LogMessagesHandler extends SubscriptionHandler<LogMessage> { @Override protected void onMessageReceived(LogMessage result) { if (result.num == lastPrintedMessageNum + 1) { flushTimer.cancel(); printLine(result); } else if (result.num > lastPrintedMessageNum) { postponedMessages.put(result.num, result); } printNextPostponedMessages(); flushTimer.schedule(5000); } LogMessagesHandler(BuildTaskDescriptor buildTaskDescriptor, BuilderConsolePresenter console, MessageBus messageBus);   }