diff --git a/src/test/java/de/gessnerfl/fakesmtp/config/FakeSmtpConfigurationPropertiesIntegrationTest.java b/src/test/java/de/gessnerfl/fakesmtp/config/FakeSmtpConfigurationPropertiesIntegrationTest.java index e13936fd..7565aa1f 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/config/FakeSmtpConfigurationPropertiesIntegrationTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/config/FakeSmtpConfigurationPropertiesIntegrationTest.java @@ -14,13 +14,13 @@ @ActiveProfiles({"integrationtest","config_integrationtest"}) @ExtendWith(SpringExtension.class) @SpringBootTest -public class FakeSmtpConfigurationPropertiesIntegrationTest { +class FakeSmtpConfigurationPropertiesIntegrationTest { @Autowired private FakeSmtpConfigurationProperties sut; @Test - public void shouldLoadConfigurationParameters() throws Exception { + void shouldLoadConfigurationParameters() throws Exception { assertEquals(1234, sut.getPort().intValue()); assertEquals(InetAddress.getByName("127.0.0.1"), sut.getBindAddress()); assertNull(sut.getAuthentication()); diff --git a/src/test/java/de/gessnerfl/fakesmtp/config/FakeSmtpConfigurationPropertiesWithAuthenticationIntegrationTest.java b/src/test/java/de/gessnerfl/fakesmtp/config/FakeSmtpConfigurationPropertiesWithAuthenticationIntegrationTest.java index 0d005a67..de72db4b 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/config/FakeSmtpConfigurationPropertiesWithAuthenticationIntegrationTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/config/FakeSmtpConfigurationPropertiesWithAuthenticationIntegrationTest.java @@ -13,13 +13,13 @@ @ActiveProfiles({"integrationtest", "config_with_auth_integrationtest"}) @ExtendWith(SpringExtension.class) @SpringBootTest -public class FakeSmtpConfigurationPropertiesWithAuthenticationIntegrationTest { +class FakeSmtpConfigurationPropertiesWithAuthenticationIntegrationTest { @Autowired private FakeSmtpConfigurationProperties sut; @Test - public void shouldLoadConfigurationParameters() throws Exception { + void shouldLoadConfigurationParameters() throws Exception { Assertions.assertEquals(1234, sut.getPort().intValue()); Assertions.assertEquals(InetAddress.getByName("127.0.0.1"), sut.getBindAddress()); Assertions.assertNotNull(sut.getAuthentication()); diff --git a/src/test/java/de/gessnerfl/fakesmtp/config/FakeSmtpConfigurationPropertiesWithPersistenceIntegrationTest.java b/src/test/java/de/gessnerfl/fakesmtp/config/FakeSmtpConfigurationPropertiesWithPersistenceIntegrationTest.java index db17e1d3..5f6a0839 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/config/FakeSmtpConfigurationPropertiesWithPersistenceIntegrationTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/config/FakeSmtpConfigurationPropertiesWithPersistenceIntegrationTest.java @@ -13,13 +13,13 @@ @ActiveProfiles({"integrationtest","config_with_persistence_integrationtest"}) @ExtendWith(SpringExtension.class) @SpringBootTest -public class FakeSmtpConfigurationPropertiesWithPersistenceIntegrationTest { +class FakeSmtpConfigurationPropertiesWithPersistenceIntegrationTest { @Autowired private FakeSmtpConfigurationProperties sut; @Test - public void shouldLoadConfigurationParameters() throws Exception { + void shouldLoadConfigurationParameters() throws Exception { Assertions.assertEquals(1234, sut.getPort().intValue()); Assertions.assertEquals(InetAddress.getByName("127.0.0.1"), sut.getBindAddress()); Assertions.assertNull(sut.getAuthentication()); diff --git a/src/test/java/de/gessnerfl/fakesmtp/controller/EmailControllerMVCIntegrationTest.java b/src/test/java/de/gessnerfl/fakesmtp/controller/EmailControllerMVCIntegrationTest.java index 859aec12..15bf0ee8 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/controller/EmailControllerMVCIntegrationTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/controller/EmailControllerMVCIntegrationTest.java @@ -22,7 +22,7 @@ @ExtendWith(SpringExtension.class) @SpringBootTest @AutoConfigureMockMvc -public class EmailControllerMVCIntegrationTest { +class EmailControllerMVCIntegrationTest { @Autowired private EmailRepository emailRepository; @@ -30,12 +30,12 @@ public class EmailControllerMVCIntegrationTest { private MockMvc mockMvc; @BeforeEach - public void init(){ + void init(){ emailRepository.deleteAll(); } @Test - public void shouldReturnEmptyListWhenNoEmailsAreAvailable() throws Exception { + void shouldReturnEmptyListWhenNoEmailsAreAvailable() throws Exception { this.mockMvc.perform(get("/email?page")) .andExpect(status().isOk()) .andExpect(model().attribute("mails", emptyIterableOf(Email.class))) @@ -44,7 +44,7 @@ public void shouldReturnEmptyListWhenNoEmailsAreAvailable() throws Exception { } @Test - public void shouldReturnListOfEmailsPagedWhenEmailsAreAvailable() throws Exception { + void shouldReturnListOfEmailsPagedWhenEmailsAreAvailable() throws Exception { var email1 = createRandomEmail(5); var email2 = createRandomEmail(2); var email3 = createRandomEmail(1); @@ -65,7 +65,7 @@ public void shouldReturnListOfEmailsPagedWhenEmailsAreAvailable() throws Excepti } @Test - public void shouldReturnFirstPageWhenGivenPageIsOutOfRange() throws Exception { + void shouldReturnFirstPageWhenGivenPageIsOutOfRange() throws Exception { createRandomEmail(1); this.mockMvc.perform(get("/email?page=1&size=2")) @@ -75,7 +75,7 @@ public void shouldReturnFirstPageWhenGivenPageIsOutOfRange() throws Exception { } @Test - public void shouldReturnMailById() throws Exception { + void shouldReturnMailById() throws Exception { var email = createRandomEmail(1); this.mockMvc.perform(get("/email/"+email.getId())) @@ -86,7 +86,7 @@ public void shouldReturnMailById() throws Exception { } @Test - public void shouldReturnErrorWhenMailIdIsNotValid() throws Exception { + void shouldReturnErrorWhenMailIdIsNotValid() throws Exception { this.mockMvc.perform(get("/email/123")) .andExpect(redirectedUrl("/email")) .andExpect(model().attributeDoesNotExist("mails", "mail")) @@ -94,7 +94,7 @@ public void shouldReturnErrorWhenMailIdIsNotValid() throws Exception { } @Test - public void shouldDeleteEmail() throws Exception { + void shouldDeleteEmail() throws Exception { var email = createRandomEmail(1); this.mockMvc.perform(delete("/email/"+email.getId())) diff --git a/src/test/java/de/gessnerfl/fakesmtp/controller/EmailControllerTest.java b/src/test/java/de/gessnerfl/fakesmtp/controller/EmailControllerTest.java index e0117362..37635960 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/controller/EmailControllerTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/controller/EmailControllerTest.java @@ -19,7 +19,7 @@ import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) -public class EmailControllerTest { +class EmailControllerTest { @Mock private Model model; @Mock @@ -30,7 +30,7 @@ public class EmailControllerTest { private EmailController sut; @Test - public void shouldReturnEmailsPaged() { + void shouldReturnEmailsPaged() { final String appVersion = "appVersion"; final Page page = createFirstPageEmail(); when(emailRepository.findAll(any(Pageable.class))).thenReturn(page); @@ -48,7 +48,7 @@ public void shouldReturnEmailsPaged() { } @Test - public void shouldReturnRedirectToFirstPageWhenRequestedPageIsOutOfRange() { + void shouldReturnRedirectToFirstPageWhenRequestedPageIsOutOfRange() { var page = mock(Page.class); when(page.getTotalPages()).thenReturn(2); when(page.getNumber()).thenReturn(3); @@ -63,7 +63,7 @@ public void shouldReturnRedirectToFirstPageWhenRequestedPageIsOutOfRange() { } @Test - public void shouldNotRedirectToFirstPageWhenNoDataIsAvailable() { + void shouldNotRedirectToFirstPageWhenNoDataIsAvailable() { final String appVersion = "appVersion"; var page = mock(Page.class); when(page.getNumber()).thenReturn(0); @@ -82,7 +82,7 @@ public void shouldNotRedirectToFirstPageWhenNoDataIsAvailable() { } @Test - public void shouldRedirectToFirstPageWhenPageNumberIsBelowNull() { + void shouldRedirectToFirstPageWhenPageNumberIsBelowNull() { var result = sut.getAll(-1, 5, model); Assertions.assertEquals(EmailController.REDIRECT_EMAIL_LIST_VIEW, result); @@ -90,7 +90,7 @@ public void shouldRedirectToFirstPageWhenPageNumberIsBelowNull() { } @Test - public void shouldRedirectToFirstPageWhenPageSizeIsNull() { + void shouldRedirectToFirstPageWhenPageSizeIsNull() { String result = sut.getAll(0, 0, model); Assertions.assertEquals(EmailController.REDIRECT_EMAIL_LIST_VIEW, result); @@ -98,7 +98,7 @@ public void shouldRedirectToFirstPageWhenPageSizeIsNull() { } @Test - public void shouldRedirectToFirstPageWhenPageSizeIsBelowNull() { + void shouldRedirectToFirstPageWhenPageSizeIsBelowNull() { var result = sut.getAll(0, -1, model); Assertions.assertEquals(EmailController.REDIRECT_EMAIL_LIST_VIEW, result); @@ -106,7 +106,7 @@ public void shouldRedirectToFirstPageWhenPageSizeIsBelowNull() { } @Test - public void shouldReturnSingleEmailWhenIdIsValid() { + void shouldReturnSingleEmailWhenIdIsValid() { final String appVersion = "appVersion"; var id = 12L; var mail = mock(Email.class); @@ -125,7 +125,7 @@ public void shouldReturnSingleEmailWhenIdIsValid() { } @Test - public void shouldReturnRedirectToListPageWhenIdIsNotValid() { + void shouldReturnRedirectToListPageWhenIdIsNotValid() { var id = 12L; when(emailRepository.findById(id)).thenReturn(Optional.empty()); @@ -150,7 +150,7 @@ private ArgumentMatcher matchPageable(int page, int size) { } @Test - public void shouldDeleteEmailByItsIdAndFlushChangesSoThatDeleteIsApplied(){ + void shouldDeleteEmailByItsIdAndFlushChangesSoThatDeleteIsApplied(){ var emailId = 123L; sut.deleteEmailById(emailId); diff --git a/src/test/java/de/gessnerfl/fakesmtp/controller/EmailRestControllerMVCIntegrationTest.java b/src/test/java/de/gessnerfl/fakesmtp/controller/EmailRestControllerMVCIntegrationTest.java index 8e0e12ff..ba9a188b 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/controller/EmailRestControllerMVCIntegrationTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/controller/EmailRestControllerMVCIntegrationTest.java @@ -30,7 +30,7 @@ @ExtendWith(SpringExtension.class) @SpringBootTest @AutoConfigureMockMvc -public class EmailRestControllerMVCIntegrationTest { +class EmailRestControllerMVCIntegrationTest { @Autowired private EmailRepository emailRepository; @@ -39,12 +39,12 @@ public class EmailRestControllerMVCIntegrationTest { private MockMvc mockMvc; @BeforeEach - public void init(){ + void init(){ emailRepository.deleteAll(); } @Test - public void shouldReturnEmptyListWhenNoEmailsAreAvailable() throws Exception { + void shouldReturnEmptyListWhenNoEmailsAreAvailable() throws Exception { MvcResult mvcResult = mockMvc.perform(get("/api/email")).andReturn(); assertEquals(200, mvcResult.getResponse().getStatus()); @@ -53,7 +53,7 @@ public void shouldReturnEmptyListWhenNoEmailsAreAvailable() throws Exception { } @Test - public void shouldReturnFirstPageOfEmails() throws Exception { + void shouldReturnFirstPageOfEmails() throws Exception { var email1 = createRandomEmail(5); var email2 = createRandomEmail(2); var email3 = createRandomEmail(1); @@ -66,7 +66,7 @@ public void shouldReturnFirstPageOfEmails() throws Exception { } @Test - public void shouldReturnSecondPageOfEmails() throws Exception { + void shouldReturnSecondPageOfEmails() throws Exception { var email1 = createRandomEmail(5); var email2 = createRandomEmail(2); var email3 = createRandomEmail(1); @@ -79,7 +79,7 @@ public void shouldReturnSecondPageOfEmails() throws Exception { } @Test - public void shouldReturnNoEmailsWhenGivenPageIsOutOfRange() throws Exception { + void shouldReturnNoEmailsWhenGivenPageIsOutOfRange() throws Exception { var email1 = createRandomEmail(5); MvcResult mvcResult = this.mockMvc.perform(get("/api/email?page=2&size=1")).andReturn(); @@ -90,7 +90,7 @@ public void shouldReturnNoEmailsWhenGivenPageIsOutOfRange() throws Exception { } @Test - public void shouldReturnMailById() throws Exception { + void shouldReturnMailById() throws Exception { var email = createRandomEmail(1); MvcResult mvcResult = this.mockMvc.perform(get("/api/email/"+email.getId())).andReturn(); @@ -101,13 +101,13 @@ public void shouldReturnMailById() throws Exception { } @Test - public void shouldReturnNotFoundCodeWhenMailIdIsNotValid() throws Exception { + void shouldReturnNotFoundCodeWhenMailIdIsNotValid() throws Exception { this.mockMvc.perform(get("/api/email/123")) .andExpect(status().isNotFound()); } @Test - public void shouldReturnAttachmentForEmail() throws Exception { + void shouldReturnAttachmentForEmail() throws Exception { var email = createRandomEmail(1); var attachment = email.getAttachments().get(0); @@ -120,7 +120,7 @@ public void shouldReturnAttachmentForEmail() throws Exception { } @Test - public void shouldReturnErrorWhenAttachmentIsRequestedButAttachmentIdIsNotValid() throws Exception { + void shouldReturnErrorWhenAttachmentIsRequestedButAttachmentIdIsNotValid() throws Exception { var email = createRandomEmail(1); this.mockMvc.perform(get("/api/email/"+email.getId()+"/attachment/123")) @@ -128,7 +128,7 @@ public void shouldReturnErrorWhenAttachmentIsRequestedButAttachmentIdIsNotValid( } @Test - public void shouldReturnErrorWhenAttachmentIsRequestedButMailIdIsNotValid() throws Exception { + void shouldReturnErrorWhenAttachmentIsRequestedButMailIdIsNotValid() throws Exception { var email = createRandomEmail(1); this.mockMvc.perform(get("/api/email/123/attachment/"+email.getAttachments().get(0).getId())) @@ -136,7 +136,7 @@ public void shouldReturnErrorWhenAttachmentIsRequestedButMailIdIsNotValid() thro } @Test - public void shouldDeleteEmail() throws Exception { + void shouldDeleteEmail() throws Exception { var email = createRandomEmail(1); this.mockMvc.perform(delete("/api/email/"+email.getId())) diff --git a/src/test/java/de/gessnerfl/fakesmtp/controller/EmailRestControllerTest.java b/src/test/java/de/gessnerfl/fakesmtp/controller/EmailRestControllerTest.java index 1496179a..49cdc387 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/controller/EmailRestControllerTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/controller/EmailRestControllerTest.java @@ -26,7 +26,7 @@ import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) -public class EmailRestControllerTest { +class EmailRestControllerTest { @Mock private EmailRepository emailRepository; @Mock @@ -40,7 +40,7 @@ public class EmailRestControllerTest { private EmailRestController sut; @Test - public void shouldReturnListOfEmails() { + void shouldReturnListOfEmails() { final Page page = createFirstPageEmail(); when(emailRepository.findAll(any(Pageable.class))).thenReturn(page); @@ -52,7 +52,7 @@ public void shouldReturnListOfEmails() { } @Test - public void shouldReturnSingleEmailWhenIdIsValid() { + void shouldReturnSingleEmailWhenIdIsValid() { var id = 12L; var mail = mock(Email.class); when(emailRepository.findById(id)).thenReturn(Optional.of(mail)); @@ -74,7 +74,7 @@ private ArgumentMatcher matchPageable(int page, int size) { } @Test - public void shouldReturnResponseEntityForAttachment() { + void shouldReturnResponseEntityForAttachment() { var fileContent = "this is the file content".getBytes(StandardCharsets.UTF_8); var filename = "myfile.txt"; var emailId = 123L; @@ -100,7 +100,7 @@ public void shouldReturnResponseEntityForAttachment() { } @Test - public void shouldThrowExceptionWhenNoAttachmentExistsForTheGivenId() { + void shouldThrowExceptionWhenNoAttachmentExistsForTheGivenId() { assertThrows(AttachmentNotFoundException.class, () -> { var emailId = 123L; var attachmentId = 456L; @@ -116,7 +116,7 @@ public void shouldThrowExceptionWhenNoAttachmentExistsForTheGivenId() { } @Test - public void shouldThrowExceptionWhenAttachmentExistsForTheGivenIdButTheEmailIdDoesNotMatch() { + void shouldThrowExceptionWhenAttachmentExistsForTheGivenIdButTheEmailIdDoesNotMatch() { assertThrows(AttachmentNotFoundException.class, () -> { var emailId = 123L; var attachmentId = 456L; @@ -128,7 +128,7 @@ public void shouldThrowExceptionWhenAttachmentExistsForTheGivenIdButTheEmailIdDo } @Test - public void shouldDeleteEmailByItsIdAndFlushChangesSoThatDeleteIsApplied() { + void shouldDeleteEmailByItsIdAndFlushChangesSoThatDeleteIsApplied() { var emailId = 123L; sut.deleteEmailById(emailId); diff --git a/src/test/java/de/gessnerfl/fakesmtp/repository/EmailRepositoryIntegrationTest.java b/src/test/java/de/gessnerfl/fakesmtp/repository/EmailRepositoryIntegrationTest.java index 51ec7d9d..0e331833 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/repository/EmailRepositoryIntegrationTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/repository/EmailRepositoryIntegrationTest.java @@ -27,19 +27,19 @@ @ActiveProfiles("integrationtest") @ExtendWith(SpringExtension.class) @SpringBootTest -public class EmailRepositoryIntegrationTest { +class EmailRepositoryIntegrationTest { private static final Sort SORT_DESC_BY_RECEIVED_ON = Sort.by(Sort.Direction.DESC, "receivedOn"); @Autowired private EmailRepository sut; @BeforeEach - public void init(){ + void init(){ sut.deleteAll(); } @Test - public void shouldDeleteEmailsWhichExceedTheRetentionLimitOfMaximumNumberOfEmails(){ + void shouldDeleteEmailsWhichExceedTheRetentionLimitOfMaximumNumberOfEmails(){ var mail1 = createRandomEmail(5); var mail2 = createRandomEmail(4); var mail3 = createRandomEmail(3); @@ -59,7 +59,7 @@ public void shouldDeleteEmailsWhichExceedTheRetentionLimitOfMaximumNumberOfEmail } @Test - public void shouldNotDeleteAnyEmailWhenTheNumberOfEmailsDoesNotExceedTheRetentionLimitOfMaximumNumberOfEmails(){ + void shouldNotDeleteAnyEmailWhenTheNumberOfEmailsDoesNotExceedTheRetentionLimitOfMaximumNumberOfEmails(){ var mail1 = createRandomEmail(5); var mail2 = createRandomEmail(4); var mail3 = createRandomEmail(3); diff --git a/src/test/java/de/gessnerfl/fakesmtp/server/EmailServerTest.java b/src/test/java/de/gessnerfl/fakesmtp/server/EmailServerTest.java index 41037b8f..1586a886 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/server/EmailServerTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/server/EmailServerTest.java @@ -11,7 +11,7 @@ import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) -public class EmailServerTest { +class EmailServerTest { @Mock private SmtpServerFactory smtpServerFactory; @@ -22,7 +22,7 @@ public class EmailServerTest { private EmailServer sut; @Test - public void shouldSetSmtpServerOnPostConstruct(){ + void shouldSetSmtpServerOnPostConstruct(){ var smtpServer = mock(SmtpServer.class); when(smtpServerFactory.create()).thenReturn(smtpServer); @@ -34,7 +34,7 @@ public void shouldSetSmtpServerOnPostConstruct(){ } @Test - public void shouldStopServerOnPreDestroy(){ + void shouldStopServerOnPreDestroy(){ var smtpServer = mock(SmtpServer.class); sut.smtpServer = smtpServer; @@ -45,7 +45,7 @@ public void shouldStopServerOnPreDestroy(){ } @Test - public void shouldSilentlyShutdownWhenNoServerIsSet(){ + void shouldSilentlyShutdownWhenNoServerIsSet(){ sut.shutdown(); verify(logger).debug(anyString()); diff --git a/src/test/java/de/gessnerfl/fakesmtp/server/impl/BasicUsernamePasswordValidatorTest.java b/src/test/java/de/gessnerfl/fakesmtp/server/impl/BasicUsernamePasswordValidatorTest.java index c0e6cff7..937f88d1 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/server/impl/BasicUsernamePasswordValidatorTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/server/impl/BasicUsernamePasswordValidatorTest.java @@ -14,7 +14,7 @@ import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) -public class BasicUsernamePasswordValidatorTest { +class BasicUsernamePasswordValidatorTest { @Mock private FakeSmtpConfigurationProperties fakeSmtpConfigurationProperties; @@ -24,7 +24,7 @@ public class BasicUsernamePasswordValidatorTest { @Test - public void shouldSuccessfullyValidateCorrectUsernameAndPassword() throws Exception { + void shouldSuccessfullyValidateCorrectUsernameAndPassword() throws Exception { var username = "username"; var password = "password"; var authentication = mock(FakeSmtpConfigurationProperties.Authentication.class); @@ -39,7 +39,7 @@ public void shouldSuccessfullyValidateCorrectUsernameAndPassword() throws Except } @Test - public void shouldThrowLoginFailedExceptionWhenUsernameIsNotValid() { + void shouldThrowLoginFailedExceptionWhenUsernameIsNotValid() { Assertions.assertThrows(LoginFailedException.class, () -> { var username = "username"; var invalidUsername = "inValidUsername"; @@ -53,7 +53,7 @@ public void shouldThrowLoginFailedExceptionWhenUsernameIsNotValid() { } @Test - public void shouldThrowLoginFailedExceptionWhenPasswordIsNotValid() { + void shouldThrowLoginFailedExceptionWhenPasswordIsNotValid() { Assertions.assertThrows(LoginFailedException.class, () -> { var username = "username"; var password = "password"; @@ -68,7 +68,7 @@ public void shouldThrowLoginFailedExceptionWhenPasswordIsNotValid() { } @Test - public void shouldThrowNullPointerExceptionWhenAuthenticationIsMissing() { + void shouldThrowNullPointerExceptionWhenAuthenticationIsMissing() { Assertions.assertThrows(NullPointerException.class, () -> { var username = "username"; var password = "password"; @@ -79,7 +79,7 @@ public void shouldThrowNullPointerExceptionWhenAuthenticationIsMissing() { } @Test - public void shouldThrowNullPointerExceptionWhenUsernameIsMissingInAuthentication() { + void shouldThrowNullPointerExceptionWhenUsernameIsMissingInAuthentication() { Assertions.assertThrows(NullPointerException.class, () -> { var username = "username"; var password = "password"; @@ -92,7 +92,7 @@ public void shouldThrowNullPointerExceptionWhenUsernameIsMissingInAuthentication } @Test - public void shouldThrowNullPointerExceptionWhenPasswordIsMissingInAuthentication() { + void shouldThrowNullPointerExceptionWhenPasswordIsMissingInAuthentication() { Assertions.assertThrows(NullPointerException.class, () -> { var username = "username"; var password = "password"; diff --git a/src/test/java/de/gessnerfl/fakesmtp/server/impl/EmailFactoryTest.java b/src/test/java/de/gessnerfl/fakesmtp/server/impl/EmailFactoryTest.java index 7961e74f..ca8ddb64 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/server/impl/EmailFactoryTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/server/impl/EmailFactoryTest.java @@ -21,7 +21,7 @@ import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) -public class EmailFactoryTest { +class EmailFactoryTest { private static final String SENDER = "sender"; private static final String RECEIVER = "receiver"; @@ -33,7 +33,7 @@ public class EmailFactoryTest { private EmailFactory sut; @Test - public void shouldCreateEmailForEmlFileWithSubjectAndContentTypePlain() throws Exception { + void shouldCreateEmailForEmlFileWithSubjectAndContentTypePlain() throws Exception { var now = new Date(); var testFilename = "mail-with-subject.eml"; var data = TestResourceUtil.getTestFileContentBytes(testFilename); @@ -57,7 +57,7 @@ public void shouldCreateEmailForEmlFileWithSubjectAndContentTypePlain() throws E } @Test - public void shouldCreateEmailForEmlFileWithSubjectAndContentTypeHtml() throws Exception { + void shouldCreateEmailForEmlFileWithSubjectAndContentTypeHtml() throws Exception { var now = new Date(); var testFilename = "mail-with-subject-and-content-type-html.eml"; var data = TestResourceUtil.getTestFileContentBytes(testFilename); @@ -81,7 +81,7 @@ public void shouldCreateEmailForEmlFileWithSubjectAndContentTypeHtml() throws Ex } @Test - public void shouldCreateEmailForEmlFileWithSubjectAndWithoutContentType() throws Exception { + void shouldCreateEmailForEmlFileWithSubjectAndWithoutContentType() throws Exception { var now = new Date(); var testFilename = "mail-with-subject-without-content-type.eml"; var data = TestResourceUtil.getTestFileContentBytes(testFilename); @@ -105,7 +105,7 @@ public void shouldCreateEmailForEmlFileWithSubjectAndWithoutContentType() throws } @Test - public void shouldCreateEmailForEmlFileWithoutSubjectAndContentTypePlain() throws Exception { + void shouldCreateEmailForEmlFileWithoutSubjectAndContentTypePlain() throws Exception { var now = new Date(); var testFilename = "mail-without-subject.eml"; var data = TestResourceUtil.getTestFileContentBytes(testFilename); @@ -129,7 +129,7 @@ public void shouldCreateEmailForEmlFileWithoutSubjectAndContentTypePlain() throw } @Test - public void shouldCreateMailForPlainText() throws Exception { + void shouldCreateMailForPlainText() throws Exception { var now = new Date(); var dataAsString = "this is just some dummy content"; var data = dataAsString.getBytes(StandardCharsets.UTF_8); @@ -152,7 +152,7 @@ public void shouldCreateMailForPlainText() throws Exception { } @Test - public void shouldCreateMailForMultipartWithContentTypeHtmlAndPlain() throws Exception { + void shouldCreateMailForMultipartWithContentTypeHtmlAndPlain() throws Exception { var now = new Date(); var testFilename = "multipart-mail.eml"; var data = TestResourceUtil.getTestFileContentBytes(testFilename); @@ -177,7 +177,7 @@ public void shouldCreateMailForMultipartWithContentTypeHtmlAndPlain() throws Exc } @Test - public void shouldCreateMailForMultipartWithoutContentTypeHtml() throws Exception { + void shouldCreateMailForMultipartWithoutContentTypeHtml() throws Exception { var now = new Date(); var testFilename = "multipart-mail-plain-only.eml"; var data = TestResourceUtil.getTestFileContentBytes(testFilename); @@ -201,7 +201,7 @@ public void shouldCreateMailForMultipartWithoutContentTypeHtml() throws Exceptio } @Test - public void shouldCreateMailForMultipartWithUnknownContentType() throws Exception { + void shouldCreateMailForMultipartWithUnknownContentType() throws Exception { var now = new Date(); var testFilename = "multipart-mail-unknown-content-type.eml"; var data = TestResourceUtil.getTestFileContentBytes(testFilename); @@ -226,7 +226,7 @@ public void shouldCreateMailForMultipartWithUnknownContentType() throws Exceptio } @Test - public void shouldCreateMailForMultipartWithPlainAndHtmlContentAndAttachments() throws Exception { + void shouldCreateMailForMultipartWithPlainAndHtmlContentAndAttachments() throws Exception { var now = new Date(); var testFilename = "multipart-mail-html-and-plain-with-attachments.eml"; var data = TestResourceUtil.getTestFileContentBytes(testFilename); diff --git a/src/test/java/de/gessnerfl/fakesmtp/server/impl/EmailFilterTest.java b/src/test/java/de/gessnerfl/fakesmtp/server/impl/EmailFilterTest.java index e9e0771e..c1e97254 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/server/impl/EmailFilterTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/server/impl/EmailFilterTest.java @@ -12,7 +12,7 @@ import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) -public class EmailFilterTest { +class EmailFilterTest { private static final String TEST_EMAIL_ADDRESS_1 = "john@doe.com"; private static final String TEST_EMAIL_ADDRESS_2 = "jane@doe.com"; @@ -26,7 +26,7 @@ public class EmailFilterTest { private EmailFilter sut; @Test - public void emptyFilter(){ + void emptyFilter(){ when(fakeSmtpConfigurationProperties.getFilteredEmailRegexList()).thenReturn(null); assertFalse(sut.ignore(TEST_EMAIL_ADDRESS_1, TEST_EMAIL_ADDRESS_2)); @@ -35,31 +35,31 @@ public void emptyFilter(){ } @Test - public void noneMatchingFilter(){ + void noneMatchingFilter(){ when(fakeSmtpConfigurationProperties.getFilteredEmailRegexList()).thenReturn(".*@google.com"); assertFalse(sut.ignore(TEST_EMAIL_ADDRESS_1,TEST_EMAIL_ADDRESS_2)); } @Test - public void matchingFilter(){ + void matchingFilter(){ when(fakeSmtpConfigurationProperties.getFilteredEmailRegexList()).thenReturn(".*@doe.com"); assertTrue(sut.ignore(TEST_EMAIL_ADDRESS_1,TEST_EMAIL_ADDRESS_2)); } @Test - public void matchingFilterMultipleRegexAnyMatch(){ + void matchingFilterMultipleRegexAnyMatch(){ when(fakeSmtpConfigurationProperties.getFilteredEmailRegexList()).thenReturn(".*@other\\.com,jane@.*"); assertTrue(sut.ignore(TEST_EMAIL_ADDRESS_1,TEST_EMAIL_ADDRESS_2)); } @Test - public void matchingFilterMultipleRegexAllMatch(){ + void matchingFilterMultipleRegexAllMatch(){ when(fakeSmtpConfigurationProperties.getFilteredEmailRegexList()).thenReturn(".*@doe\\.com,jane@.*"); assertTrue(sut.ignore(TEST_EMAIL_ADDRESS_1,TEST_EMAIL_ADDRESS_2)); } @Test - public void invalidRegex(){ + void invalidRegex(){ when(fakeSmtpConfigurationProperties.getFilteredEmailRegexList()).thenReturn("****"); assertFalse(sut.ignore(TEST_EMAIL_ADDRESS_1,TEST_EMAIL_ADDRESS_2)); } diff --git a/src/test/java/de/gessnerfl/fakesmtp/server/impl/JavaMailSenderFacadeTest.java b/src/test/java/de/gessnerfl/fakesmtp/server/impl/JavaMailSenderFacadeTest.java index 262520fb..bc0194c4 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/server/impl/JavaMailSenderFacadeTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/server/impl/JavaMailSenderFacadeTest.java @@ -9,10 +9,10 @@ import static org.mockito.Mockito.*; -public class JavaMailSenderFacadeTest { +class JavaMailSenderFacadeTest { @Test - public void shouldSendMimeMessageWhenMailSystemIsAvailable() { + void shouldSendMimeMessageWhenMailSystemIsAvailable() { var javaMailSender = mock(JavaMailSender.class); var logger = mock(Logger.class); var mimeMessage = mock(MimeMessage.class); @@ -29,7 +29,7 @@ public void shouldSendMimeMessageWhenMailSystemIsAvailable() { } @Test - public void shouldLogErrorAndSkipSendingOfMimeMessageWhenMailSystemIsNotAvailable() { + void shouldLogErrorAndSkipSendingOfMimeMessageWhenMailSystemIsNotAvailable() { var logger = mock(Logger.class); var mimeMessage = mock(MimeMessage.class); @@ -43,7 +43,7 @@ public void shouldLogErrorAndSkipSendingOfMimeMessageWhenMailSystemIsNotAvailabl } @Test - public void shouldSendSimpleMessageWhenMailSystemIsAvailable() { + void shouldSendSimpleMessageWhenMailSystemIsAvailable() { var javaMailSender = mock(JavaMailSender.class); var logger = mock(Logger.class); var message = mock(SimpleMailMessage.class); @@ -60,7 +60,7 @@ public void shouldSendSimpleMessageWhenMailSystemIsAvailable() { } @Test - public void shouldLogErrorAndSkipSendingOfSimpleMessageWhenMailSystemIsNotAvailable() { + void shouldLogErrorAndSkipSendingOfSimpleMessageWhenMailSystemIsNotAvailable() { var logger = mock(Logger.class); var message = mock(SimpleMailMessage.class); diff --git a/src/test/java/de/gessnerfl/fakesmtp/server/impl/MessageForwarderTest.java b/src/test/java/de/gessnerfl/fakesmtp/server/impl/MessageForwarderTest.java index ecdebbe6..d7dd8776 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/server/impl/MessageForwarderTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/server/impl/MessageForwarderTest.java @@ -17,7 +17,7 @@ import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) -public class MessageForwarderTest { +class MessageForwarderTest { @Mock private FakeSmtpConfigurationProperties configurationProperties; @@ -30,7 +30,7 @@ public class MessageForwarderTest { private MessageForwarder sut; @Test - public void shouldSkipForwardingWhenForwardingIsNotEnabled() throws Exception { + void shouldSkipForwardingWhenForwardingIsNotEnabled() throws Exception { var rawData = mock(RawData.class); when(configurationProperties.isForwardEmails()).thenReturn(false); @@ -41,7 +41,7 @@ public void shouldSkipForwardingWhenForwardingIsNotEnabled() throws Exception { } @Test - public void shouldForwardMimeMessageWhenForwardingIsEnabledAndEmailCanBeConvertedToMimeMessage() throws Exception { + void shouldForwardMimeMessageWhenForwardingIsEnabledAndEmailCanBeConvertedToMimeMessage() throws Exception { var mimeMessage = mock(MimeMessage.class); var rawData = mock(RawData.class); when(rawData.toMimeMessage()).thenReturn(mimeMessage); @@ -55,7 +55,7 @@ public void shouldForwardMimeMessageWhenForwardingIsEnabledAndEmailCanBeConverte } @Test - public void shouldForwardEmailAsSimpleMessageWhenForwardingIsEnabledAndEmailCannotBeConvertedToMimeMessage() throws Exception { + void shouldForwardEmailAsSimpleMessageWhenForwardingIsEnabledAndEmailCannotBeConvertedToMimeMessage() throws Exception { var expectedException = new MessagingException("test"); var from = "from"; var to = "to"; diff --git a/src/test/java/de/gessnerfl/fakesmtp/server/impl/MessageListenerIntegrationTest.java b/src/test/java/de/gessnerfl/fakesmtp/server/impl/MessageListenerIntegrationTest.java index b2e4fac3..b4787cf8 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/server/impl/MessageListenerIntegrationTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/server/impl/MessageListenerIntegrationTest.java @@ -22,7 +22,7 @@ @ActiveProfiles("integrationtest") @ExtendWith(SpringExtension.class) @SpringBootTest -public class MessageListenerIntegrationTest { +class MessageListenerIntegrationTest { private static final String SENDER = "sender"; private static final String RECEIVER = "receiver"; @@ -33,12 +33,12 @@ public class MessageListenerIntegrationTest { private MessageListener sut; @BeforeEach - public void setup(){ + void setup(){ emailRepository.deleteAll(); } @Test - public void shouldCreateEmailForEmlFileWithSubject() throws Exception { + void shouldCreateEmailForEmlFileWithSubject() throws Exception { var testFilename = "mail-with-subject.eml"; var data = TestResourceUtil.getTestFile(testFilename); var rawData = TestResourceUtil.getTestFileContent(testFilename); @@ -62,7 +62,7 @@ public void shouldCreateEmailForEmlFileWithSubject() throws Exception { } @Test - public void shouldCreateEmailForEmlFileWithoutSubject() throws Exception { + void shouldCreateEmailForEmlFileWithoutSubject() throws Exception { var testFilename = "mail-without-subject.eml"; var data = TestResourceUtil.getTestFile(testFilename); var rawData = TestResourceUtil.getTestFileContent(testFilename); @@ -86,7 +86,7 @@ public void shouldCreateEmailForEmlFileWithoutSubject() throws Exception { } @Test - public void shouldCreateMailForPlainText() throws Exception { + void shouldCreateMailForPlainText() throws Exception { var rawData = "this is just some dummy content"; var data = new ByteArrayInputStream(rawData.getBytes(StandardCharsets.UTF_8)); diff --git a/src/test/java/de/gessnerfl/fakesmtp/server/impl/MessageListenerTest.java b/src/test/java/de/gessnerfl/fakesmtp/server/impl/MessageListenerTest.java index 6fc690c5..e44113df 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/server/impl/MessageListenerTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/server/impl/MessageListenerTest.java @@ -18,7 +18,7 @@ import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) -public class MessageListenerTest { +class MessageListenerTest { @Mock private EmailFactory emailFactory; @@ -35,12 +35,12 @@ public class MessageListenerTest { private MessageListener sut; @Test - public void shouldAcceptAllMails(){ + void shouldAcceptAllMails(){ assertTrue(sut.accept("foo", "bar")); } @Test - public void shouldCreateEmailEntityAndStoreItInDatabaseWhenEmailIsDelivered() throws IOException { + void shouldCreateEmailEntityAndStoreItInDatabaseWhenEmailIsDelivered() throws IOException { var from = "from"; var to = "to"; var contentString = "content"; @@ -63,14 +63,15 @@ public void shouldCreateEmailEntityAndStoreItInDatabaseWhenEmailIsDelivered() th } @Test - public void shouldThrowExceptionWhenEmailEntityCannotBeCreatedWhenEmailIsDelivered() { - assertThrows(IOException.class, () -> { - var from = "from"; - var to = "to"; - var content = "content".getBytes(StandardCharsets.UTF_8); - var contentStream = new ByteArrayInputStream(content); + void shouldThrowExceptionWhenEmailEntityCannotBeCreatedWhenEmailIsDelivered() throws IOException { + var from = "from"; + var to = "to"; + var content = "content".getBytes(StandardCharsets.UTF_8); + var contentStream = new ByteArrayInputStream(content); + + when(emailFactory.convert(any(RawData.class))).thenThrow(new IOException("foo")); - when(emailFactory.convert(any(RawData.class))).thenThrow(new IOException("foo")); + assertThrows(IOException.class, () -> { sut.deliver(from, to, contentStream); diff --git a/src/test/java/de/gessnerfl/fakesmtp/server/impl/RawDataTest.java b/src/test/java/de/gessnerfl/fakesmtp/server/impl/RawDataTest.java index 087757d0..7c0fa7ef 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/server/impl/RawDataTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/server/impl/RawDataTest.java @@ -6,10 +6,10 @@ import javax.mail.internet.MimeMessage; -public class RawDataTest { +class RawDataTest { @Test - public void shouldReturnMimeMessage() throws Exception { + void shouldReturnMimeMessage() throws Exception { RawData sut = new RawData("from", "to", TestResourceUtil.getTestFileContentBytes(("mail-with-subject.eml"))); MimeMessage message = sut.toMimeMessage(); diff --git a/src/test/java/de/gessnerfl/fakesmtp/server/impl/SmtpServerConfiguratorTest.java b/src/test/java/de/gessnerfl/fakesmtp/server/impl/SmtpServerConfiguratorTest.java index 36600329..8fba39ef 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/server/impl/SmtpServerConfiguratorTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/server/impl/SmtpServerConfiguratorTest.java @@ -20,7 +20,7 @@ import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) -public class SmtpServerConfiguratorTest { +class SmtpServerConfiguratorTest { @Mock private FakeSmtpConfigurationProperties fakeSmtpConfigurationProperties; @@ -33,7 +33,7 @@ public class SmtpServerConfiguratorTest { private SmtpServerConfigurator sut; @Test - public void shouldConfigureBasicParameters(){ + void shouldConfigureBasicParameters(){ var port = 1234; var bindingAddress = mock(InetAddress.class); when(fakeSmtpConfigurationProperties.getPort()).thenReturn(port); @@ -49,7 +49,7 @@ public void shouldConfigureBasicParameters(){ } @Test - public void shouldConfigureAuthenticationWhenAuthenticationIsConfiguredProperly(){ + void shouldConfigureAuthenticationWhenAuthenticationIsConfiguredProperly(){ var username = "username"; var password = "password"; var authentication = mock(FakeSmtpConfigurationProperties.Authentication.class); @@ -73,7 +73,7 @@ public void shouldConfigureAuthenticationWhenAuthenticationIsConfiguredProperly( } @Test - public void shouldSkipConfigurationOfAuthenticationWhenUsernameIsNull(){ + void shouldSkipConfigurationOfAuthenticationWhenUsernameIsNull(){ var authentication = mock(FakeSmtpConfigurationProperties.Authentication.class); when(authentication.getUsername()).thenReturn(null); when(fakeSmtpConfigurationProperties.getAuthentication()).thenReturn(authentication); @@ -87,7 +87,7 @@ public void shouldSkipConfigurationOfAuthenticationWhenUsernameIsNull(){ } @Test - public void shouldSkipConfigurationOfAuthenticationWhenUsernameIsEmptyString(){ + void shouldSkipConfigurationOfAuthenticationWhenUsernameIsEmptyString(){ var authentication = mock(FakeSmtpConfigurationProperties.Authentication.class); when(authentication.getUsername()).thenReturn(""); when(fakeSmtpConfigurationProperties.getAuthentication()).thenReturn(authentication); @@ -101,7 +101,7 @@ public void shouldSkipConfigurationOfAuthenticationWhenUsernameIsEmptyString(){ } @Test - public void shouldSkipConfigurationOfAuthenticationWhenPasswordIsNull(){ + void shouldSkipConfigurationOfAuthenticationWhenPasswordIsNull(){ var username = "username"; var authentication = mock(FakeSmtpConfigurationProperties.Authentication.class); when(authentication.getUsername()).thenReturn(username); @@ -117,7 +117,7 @@ public void shouldSkipConfigurationOfAuthenticationWhenPasswordIsNull(){ } @Test - public void shouldSkipConfigurationOfAuthenticationWhenPasswordIsEmptyString(){ + void shouldSkipConfigurationOfAuthenticationWhenPasswordIsEmptyString(){ var username = "username"; var authentication = mock(FakeSmtpConfigurationProperties.Authentication.class); when(authentication.getUsername()).thenReturn(username); diff --git a/src/test/java/de/gessnerfl/fakesmtp/server/impl/SmtpServerFactoryImplTest.java b/src/test/java/de/gessnerfl/fakesmtp/server/impl/SmtpServerFactoryImplTest.java index 3c4e51c0..e31d51e3 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/server/impl/SmtpServerFactoryImplTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/server/impl/SmtpServerFactoryImplTest.java @@ -12,7 +12,7 @@ import static org.mockito.Mockito.verify; @ExtendWith(MockitoExtension.class) -public class SmtpServerFactoryImplTest { +class SmtpServerFactoryImplTest { private final int PORT = 25; @Mock @@ -24,7 +24,7 @@ public class SmtpServerFactoryImplTest { private SmtpServerFactoryImpl sut; @Test - public void shouldCreateAndConfigureNewInsance(){ + void shouldCreateAndConfigureNewInsance(){ var smtpServer = sut.create(); MatcherAssert.assertThat(smtpServer, instanceOf(SmtpServerImpl.class)); diff --git a/src/test/java/de/gessnerfl/fakesmtp/server/impl/SmtpServerImplTest.java b/src/test/java/de/gessnerfl/fakesmtp/server/impl/SmtpServerImplTest.java index 6a94b7e0..e18f0741 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/server/impl/SmtpServerImplTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/server/impl/SmtpServerImplTest.java @@ -6,10 +6,10 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; -public class SmtpServerImplTest { +class SmtpServerImplTest { @Test - public void shouldCreateNewInstanceAndDelegateCallsToRealImplementation(){ + void shouldCreateNewInstanceAndDelegateCallsToRealImplementation(){ var delegate = mock(SMTPServer.class); var sut = new SmtpServerImpl(delegate); diff --git a/src/test/java/de/gessnerfl/fakesmtp/service/EmailRetentionTimerTest.java b/src/test/java/de/gessnerfl/fakesmtp/service/EmailRetentionTimerTest.java index 6990d093..224fde3f 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/service/EmailRetentionTimerTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/service/EmailRetentionTimerTest.java @@ -12,7 +12,7 @@ import static org.mockito.Mockito.*; @ExtendWith(MockitoExtension.class) -public class EmailRetentionTimerTest { +class EmailRetentionTimerTest { @Mock private FakeSmtpConfigurationProperties fakeSmtpConfigurationProperties; @@ -25,7 +25,7 @@ public class EmailRetentionTimerTest { private EmailRetentionTimer sut; @Test - public void shouldTriggerDeletionWhenDataRetentionIsConfigured(){ + void shouldTriggerDeletionWhenDataRetentionIsConfigured(){ var maxNumber = 5; var persistence = mock(FakeSmtpConfigurationProperties.Persistence.class); when(persistence.getMaxNumberEmails()).thenReturn(maxNumber); @@ -37,7 +37,7 @@ public void shouldTriggerDeletionWhenDataRetentionIsConfigured(){ } @Test - public void shouldNotTriggerDeletionWhenConfiguredMaxNumberIsNull(){ + void shouldNotTriggerDeletionWhenConfiguredMaxNumberIsNull(){ var persistence = mock(FakeSmtpConfigurationProperties.Persistence.class); when(persistence.getMaxNumberEmails()).thenReturn(null); when(fakeSmtpConfigurationProperties.getPersistence()).thenReturn(persistence); @@ -48,7 +48,7 @@ public void shouldNotTriggerDeletionWhenConfiguredMaxNumberIsNull(){ } @Test - public void shouldNotTriggerDeletionWhenConfiguredMaxNumberIsLessOrEqualToZero(){ + void shouldNotTriggerDeletionWhenConfiguredMaxNumberIsLessOrEqualToZero(){ var persistence = mock(FakeSmtpConfigurationProperties.Persistence.class); when(persistence.getMaxNumberEmails()).thenReturn(0); when(fakeSmtpConfigurationProperties.getPersistence()).thenReturn(persistence); @@ -59,7 +59,7 @@ public void shouldNotTriggerDeletionWhenConfiguredMaxNumberIsLessOrEqualToZero() } @Test - public void shouldNotTriggerDeletionWhenNoPersistenceIsConfigured(){ + void shouldNotTriggerDeletionWhenNoPersistenceIsConfigured(){ when(fakeSmtpConfigurationProperties.getPersistence()).thenReturn(null); sut.deleteOutdatedMails(); diff --git a/src/test/java/de/gessnerfl/fakesmtp/util/MediaTypeUtilTest.java b/src/test/java/de/gessnerfl/fakesmtp/util/MediaTypeUtilTest.java index 170c15f4..e72f58d3 100644 --- a/src/test/java/de/gessnerfl/fakesmtp/util/MediaTypeUtilTest.java +++ b/src/test/java/de/gessnerfl/fakesmtp/util/MediaTypeUtilTest.java @@ -10,20 +10,20 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -public class MediaTypeUtilTest { +class MediaTypeUtilTest { private ServletContext servletContext; private MediaTypeUtil sut; @BeforeEach - public void init(){ + void init(){ servletContext = mock(ServletContext.class); sut = new MediaTypeUtil(); } @Test - public void shouldReturnMediaTypeForDefaultMimeType(){ + void shouldReturnMediaTypeForDefaultMimeType(){ var filename = "mypicture.png"; when(servletContext.getMimeType(filename)).thenReturn(MediaType.IMAGE_PNG_VALUE); @@ -34,7 +34,7 @@ public void shouldReturnMediaTypeForDefaultMimeType(){ } @Test - public void shouldReturnMappedMimeTimeForNonDefaultMediaType(){ + void shouldReturnMappedMimeTimeForNonDefaultMediaType(){ var filename = "my-word-file.docx"; when(servletContext.getMimeType(filename)).thenReturn("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); @@ -45,7 +45,7 @@ public void shouldReturnMappedMimeTimeForNonDefaultMediaType(){ } @Test - public void shouldReturnOctedStreamForInvalidMediaType(){ + void shouldReturnOctedStreamForInvalidMediaType(){ var filename = "my-word-file.foo"; when(servletContext.getMimeType(filename)).thenReturn("invalidMediaType");