From b5424ee5aa4a8a64f1fd2a190f465654eb880a24 Mon Sep 17 00:00:00 2001 From: Andreas Hufler Date: Thu, 19 Oct 2023 16:56:51 +0200 Subject: [PATCH] fix tests --- .../emailservice/lib/application/ManageEmailTest.java | 7 +++++++ 1 file changed, 7 insertions(+) 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();