EmailEngine extends TemplatedNotificationEngine { protected Message buildMessage(Notification notification) throws Exception { if (notification instanceof CheckNotification) { return this.buildCheckMessage((CheckNotification) notification); } else if (notification instanceof GenericNotification) { return this.buildGenericMessage((GenericNotification) notification); } return null; } EmailEngine(); @Override boolean accept(Notification notification); @Override void sendNotification(Notification notification); static final String NAME; }
@Test public void testServiceUpdateBuildMessage() throws Exception { SendUpdate message = this.loadMessage(SendUpdate.class, "update/service.json"); Message m = this.engine.buildMessage(message); assertThat(m, is(notNullValue())); assertThat(m.getContent(), is(notNullValue())); assertThat(m.getAllHeaders(), is(notNullValue())); assertThat(m.getHeader("Message-ID")[0], is(equalTo("<a9f82618-9801-4b91-8bed-9c8c01f883ad.update.bergamot>"))); }