Search in sources :

Example 1 with Provider

use of jakarta.mail.Provider in project spring-boot by spring-projects.

the class MailHealthIndicatorTests method setup.

@BeforeEach
void setup() {
    Session session = Session.getDefaultInstance(new Properties());
    session.addProvider(new Provider(Type.TRANSPORT, "success", SuccessTransport.class.getName(), "Test", "1.0.0"));
    this.mailSender = mock(JavaMailSenderImpl.class);
    given(this.mailSender.getHost()).willReturn("smtp.acme.org");
    given(this.mailSender.getPort()).willReturn(25);
    given(this.mailSender.getSession()).willReturn(session);
    this.indicator = new MailHealthIndicator(this.mailSender);
}
Also used : JavaMailSenderImpl(org.springframework.mail.javamail.JavaMailSenderImpl) Properties(java.util.Properties) Session(jakarta.mail.Session) Provider(jakarta.mail.Provider) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

Provider (jakarta.mail.Provider)1 Session (jakarta.mail.Session)1 Properties (java.util.Properties)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1 JavaMailSenderImpl (org.springframework.mail.javamail.JavaMailSenderImpl)1