@Test
public void testSendErrorEmail() throws Exception {

  final Flow flow = this.project.getFlow("jobe");
  flow.addFailureEmails(this.receiveAddrList);
  Assert.assertNotNull(flow);
  final ExecutableFlow exFlow = new ExecutableFlow(this.project, flow);
  final CommonMetrics commonMetrics = new CommonMetrics(new MetricsManager(new MetricRegistry()));
  final Emailer emailer = new Emailer(this.props, commonMetrics, this.messageCreator,
      this.executorLoader);
  emailer.alertOnError(exFlow);
  verify(this.message).addAllToAddress(this.receiveAddrList);
  verify(this.message).setSubject("Flow 'jobe' has failed on azkaban");
  assertThat(TestUtils.readResource("errorEmail2.html", this))
      .isEqualToIgnoringWhitespace(this.message.getBody());
}