-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be44652
commit 3028dfa
Showing
6 changed files
with
9 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -589,30 +589,23 @@ public void testRequestNewEmail() throws BusinessException { | |
// Check update db | ||
Assertions.assertNotNull(configurationBusiness.getUser(emailUser2)); | ||
Assertions.assertEquals("[email protected]", configurationBusiness.getUser(emailUser2).getNextEmail(), "Incorrect user next email"); | ||
|
||
} | ||
|
||
|
||
@Test | ||
public void testSendContactEmail() throws BusinessException, DAOException { | ||
// Reset not to capture the calls to sendEmail in the Setup | ||
Mockito.reset(emailBusiness); | ||
Mockito.doReturn(new String[]{"[email protected]"}).when(emailBusiness).getAdministratorsEmails(); | ||
|
||
// Capture email content | ||
ArgumentCaptor<String> emailContent = ArgumentCaptor.forClass(String.class); | ||
// Capture email recipient | ||
ArgumentCaptor<String[]> emailRecipients = ArgumentCaptor.forClass(String[].class); | ||
|
||
configurationBusiness.sendContactMail(user1, "category", "subject", "comment"); | ||
Mockito.verify(emailBusiness).sendEmail(Mockito.anyString(), emailContent.capture(), emailRecipients.capture(), Mockito.eq(true), Mockito.anyString()); | ||
Mockito.verify(emailBusiness).sendEmailToAdmins(Mockito.anyString(), emailContent.capture(), Mockito.eq(true), Mockito.anyString()); | ||
|
||
// Check email content | ||
Assertions.assertTrue(emailContent.getValue().contains(user1.getFirstName()), "Incorrect user firstname"); | ||
Assertions.assertTrue(emailContent.getValue().contains(user1.getLastName()), "Incorrect user lastname"); | ||
// Check recipient | ||
Assertions.assertEquals(1, emailRecipients.getValue().length, "Incorrect length of recipients"); | ||
Assertions.assertEquals(adminEmail, emailRecipients.getValue()[0], "Incorrect user recipient"); | ||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters