GarmadonSparkListener extends SparkListener { @Override public void onExecutorBlacklisted(SparkListenerExecutorBlacklisted executorBlacklisted) { try { sendExecutorStateEvent(executorBlacklisted.time(), State.BLACKLISTED, executorBlacklisted.executorId(), executorHostId.getOrDefault(executorBlacklisted.executorId(), "UNKNOWN"), null, executorBlacklisted.taskFailures()); } catch (Throwable t) { LOGGER.warn("Failed to send event for onExecutorBlacklisted", t); } } GarmadonSparkListener();  GarmadonSparkListener(TriConsumer<Long, Header, Object> eventHandler, Header.SerializedHeader header); @Override void onApplicationStart(SparkListenerApplicationStart applicationStart); @Override void onStageSubmitted(SparkListenerStageSubmitted stageSubmitted); @Override void onStageCompleted(SparkListenerStageCompleted stageCompleted); @Override void onTaskEnd(SparkListenerTaskEnd taskEnd); @Override void onExecutorAdded(SparkListenerExecutorAdded executorAdded); @Override void onExecutorRemoved(SparkListenerExecutorRemoved executorRemoved); @Override void onExecutorBlacklisted(SparkListenerExecutorBlacklisted executorBlacklisted); @Override void onExecutorUnblacklisted(SparkListenerExecutorUnblacklisted executorUnblacklisted);  }
@Test public void onExecutorBlacklisted() { TriConsumer<Long,Header, Object> handlerMock = mock(TriConsumer.class); SparkListener listener = new GarmadonSparkListener(handlerMock, DUMMY_HEADER.toSerializeHeader()); listener.onExecutorBlacklisted(new SparkListenerExecutorBlacklisted(1, "invokationExecutorId", 12)); checkExecutorEventHeader(handlerMock, DUMMY_HEADER.cloneAndOverride(Header.newBuilder() .withExecutorId("invokationExecutorId").build())); }