Testing Email Sending for Spring Boot Applications With GreenMail (Sandbox Email Server)

Опубликовано: 29 Сентябрь 2024
на канале: Philip Riecks
6,960
77

This video showcases a testing recipe to write integration tests that involve email sending. To avoid real emails being sent out for our tests, we can use a sandbox email server to capture and verify all emails.

For demonstration purposes, we're using a Spring Boot application (JavaMailSender) and GreenMail but the recipe can be applied to any Java application.

Content:

00:00 Sample application walkthrough
03:19 Adding GreenMail to the project
05:20 Integration test setup to trigger the email sending
08:20 Adding GreenMail's JUnit Jupiter extension
12:00 Verifying the received emails after our test

You can find the source code for this test example on GitHub: https://github.com/rieckpil/blog-tuto...


» Getting started with testing Spring Boot applications in three hours with the Testing Spring Boot Applications Primer Online Course: https://rieckpil.de/testing-spring-bo...

#springboot #greenmail #testing #junit5 #integrationtesting