Search in sources :

Example 1 with UserTaskDeadlineEventBody

use of org.kie.kogito.services.event.impl.UserTaskDeadlineEventBody in project kogito-runtimes by kiegroup.

the class QuarkusMailSenderTest method testMail.

@Test
void testMail() {
    UserTaskDeadlineDataEvent event = Mockito.mock(UserTaskDeadlineDataEvent.class);
    Map<String, Object> notification = new HashMap<>();
    notification.put(MailInfo.SUBJECT_PROPERTY, SUBJECT);
    notification.put(MailInfo.BODY_PROPERTY, TEXT);
    notification.put(MailInfo.FROM_PROPERTY, "realbetisbalompie@gmail.com");
    notification.put(MailInfo.TO_PROPERTY, TO + ",fulanito@doesnotexist.com");
    UserTaskDeadlineEventBody eventData = UserTaskDeadlineEventBody.create("1", notification).build();
    Mockito.when(event.getData()).thenReturn(eventData);
    sender.onDeadline(event);
    List<Mail> messages = mailBox.getMessagesSentTo(TO);
    assertEquals(1, messages.size());
    Mail message = messages.get(0);
    assertEquals(TEXT, message.getText());
    assertEquals(SUBJECT, message.getSubject());
}
Also used : Mail(io.quarkus.mailer.Mail) HashMap(java.util.HashMap) UserTaskDeadlineDataEvent(org.kie.kogito.services.event.UserTaskDeadlineDataEvent) UserTaskDeadlineEventBody(org.kie.kogito.services.event.impl.UserTaskDeadlineEventBody) QuarkusTest(io.quarkus.test.junit.QuarkusTest) Test(org.junit.jupiter.api.Test)

Aggregations

Mail (io.quarkus.mailer.Mail)1 QuarkusTest (io.quarkus.test.junit.QuarkusTest)1 HashMap (java.util.HashMap)1 Test (org.junit.jupiter.api.Test)1 UserTaskDeadlineDataEvent (org.kie.kogito.services.event.UserTaskDeadlineDataEvent)1 UserTaskDeadlineEventBody (org.kie.kogito.services.event.impl.UserTaskDeadlineEventBody)1