EventMessageHandler implements MessageHandler<EventMessage> { @Override public void handle(String key, EventMessage message) { if (message.errorCode == null) return; alertService.process(alert(message)); }  @Override void handle(String key, EventMessage message);  }
@Test void handleOKAction() { var message = new EventMessage(); message.result = "OK"; message.errorCode = null; handler.handle(null, message); verifyNoInteractions(alertService); }
@Test void handle() { var message = new EventMessage(); message.result = "ERROR"; message.errorCode = "RUNTIME_ERROR"; handler.handle(null, message); verify(alertService).process(argThat(alert -> alert.severity == Severity.ERROR)); }