diff --git a/src/test/java/it/aboutbits/springboot/emailservice/lib/application/ManageEmailTest.java b/src/test/java/it/aboutbits/springboot/emailservice/lib/application/ManageEmailTest.java index eeb62f6..3cc1626 100644 --- a/src/test/java/it/aboutbits/springboot/emailservice/lib/application/ManageEmailTest.java +++ b/src/test/java/it/aboutbits/springboot/emailservice/lib/application/ManageEmailTest.java @@ -6,6 +6,7 @@ import it.aboutbits.springboot.emailservice.lib.exception.EmailException; import it.aboutbits.springboot.emailservice.support.database.WithPostgres; import jakarta.mail.internet.MimeMessage; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; @@ -21,6 +22,7 @@ import static org.assertj.core.api.Assertions.assertThatExceptionOfType; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.anyLong; +import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doThrow; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; @@ -38,6 +40,11 @@ class ManageEmailTest { @Autowired private ManageEmail manageEmail; + @BeforeEach + void setup() { + doNothing().when(javaMailSender).send(any(MimeMessage.class)); + } + @Test void givenRequiredParameters_schedule_shouldCreateNewNotification() throws EmailException { var parameter = getValidParameterWithoutAttachment();