DeleteEntryPointSubscriber implements Consumer<DeleteEntryPointEvent> { @Override public void accept(DeleteEntryPointEvent deleteEntryPointEvent) { try { nsqDispatcher.sendDeleteRequested(deleteEntryPointEvent.getCorrelationId(), deleteEntryPointEvent.getHaproxyName(), deleteEntryPointEvent.getApplication(), deleteEntryPointEvent.getPlatform()); } catch (Exception e) { LOGGER.error("Unable to send delete entry point event {} to NSQ because of the following errors", deleteEntryPointEvent, e); } } DeleteEntryPointSubscriber(NSQDispatcher nsqDispatcher); @Override void accept(DeleteEntryPointEvent deleteEntryPointEvent);  }
@Test public void should_send_event_to_nsq_dispatcher() throws Exception { deleteEntryPointSubscriber.accept(deleteEntryPointEvent); verify(nsqDispatcher).sendDeleteRequested("cId", "hap", "app", "ptf"); }
@Test public void should_handle_exceptions_from_nsq_dispatcher() throws Exception { doThrow(new RuntimeException()).when(nsqDispatcher).sendDeleteRequested("cId", "hap", "app", "ptf"); deleteEntryPointSubscriber.accept(deleteEntryPointEvent); }