@Test public void descriptionIsNotIncludedIfEmpty() { Check check = new Check() .withId("123") .withEnabled(true) .withName("test-check") .withDescription("") .withWarn(new BigDecimal("2.0")) .withError(new BigDecimal("3.0")) .withState(AlertType.ERROR); Subscription subscription = new Subscription() .withEnabled(true) .withType(SubscriptionType.EMAIL) .withTarget("some@email.com"); Alert alert = new Alert() .withTarget("some.value") .withValue(new BigDecimal("4.0")) .withTimestamp(new DateTime()) .withFromType(AlertType.OK) .withToType(AlertType.ERROR); List<Alert> alerts = Arrays.asList(alert); String body = emailHelper.createBody(check, subscription, alerts); assertThat(body, not(containsString("<p></p>"))); }
@Override public String createBody(Check check, Subscription subscription, List<Alert> alerts) { return evaluateTemplate(check, subscription, alerts, TEMPLATE_CONTENT); }
VelocityEmailHelper implements EmailHelper { @Override public String createBody(Check check, Subscription subscription, List<Alert> alerts) { return evaluateTemplate(check, subscription, alerts, TEMPLATE_CONTENT); } }
VelocityEmailHelper implements EmailHelper { @Override public String createBody(Check check, Subscription subscription, List<Alert> alerts) { return evaluateTemplate(check, subscription, alerts, TEMPLATE_CONTENT); } @Inject  VelocityEmailHelper(SeyrenConfig seyrenConfig); }
VelocityEmailHelper implements EmailHelper { @Override public String createBody(Check check, Subscription subscription, List<Alert> alerts) { return evaluateTemplate(check, subscription, alerts, TEMPLATE_CONTENT); } @Inject  VelocityEmailHelper(SeyrenConfig seyrenConfig); String createSubject(Check check, Subscription subscription, List<Alert> alerts); @Override String createBody(Check check, Subscription subscription, List<Alert> alerts); }
VelocityEmailHelper implements EmailHelper { @Override public String createBody(Check check, Subscription subscription, List<Alert> alerts) { return evaluateTemplate(check, subscription, alerts, TEMPLATE_CONTENT); } @Inject  VelocityEmailHelper(SeyrenConfig seyrenConfig); String createSubject(Check check, Subscription subscription, List<Alert> alerts); @Override String createBody(Check check, Subscription subscription, List<Alert> alerts);  }