TriggerInstanceProcessor { public void processTermination(final TriggerInstance triggerInst) { this.executorService.submit(() -> sendFailureEmailIfConfigured(triggerInst)); } @Inject  TriggerInstanceProcessor(final ExecutorManagerAdapter executorManager,
      final FlowTriggerInstanceLoader flowTriggerInstanceLoader,
      final Emailer emailer); void processSucceed(final TriggerInstance triggerInst); void processTermination(final TriggerInstance triggerInst); void processNewInstance(final TriggerInstance triggerInst); void shutdown();  }
@Test public void testProcessTermination() throws Exception { final TriggerInstance triggerInstance = createTriggerInstance(); this.processor.processTermination(triggerInstance); this.sendEmailLatch.await(10L, TimeUnit.SECONDS); assertEquals(0, this.sendEmailLatch.getCount()); verify(this.message).setSubject( "flow trigger for flow 'flowId', project 'proj' has been cancelled on azkaban"); assertThat(TestUtils.readResource("/emailTemplate/flowtriggerfailureemail.html", this)) .isEqualToIgnoringWhitespace(this.message.getBody()); }