@Test public void sends_email_to_admins_containing_projectid_base_and_reason() throws Exception { when(mockedNotificationConfiguration.getEmailAdministrators()).thenReturn("adminMail"); SimpleMailMessage mockedMailMessage = mock(SimpleMailMessage.class); when(mockedMailMessageFactory.createMessage(any())).thenReturn(mockedMailMessage); ProjectMessage message = mock(ProjectMessage.class); when(message.getProjectId()).thenReturn("projectId1"); when(message.getProjectOwnerEmailAddress()).thenReturn("owner1@example.org"); when(message.getProjectActionTriggeredBy()).thenReturn("reason1"); serviceToTest.notify(message,"base1"); ArgumentCaptor<SimpleMailMessage> mailMessageCaptor = ArgumentCaptor.forClass(SimpleMailMessage.class); verify(mockedEmailService).send(mailMessageCaptor.capture()); assertSame(mockedMailMessage, mailMessageCaptor.getValue()); verify(mockedMailMessage).setTo("adminMail"); ArgumentCaptor<String> stringMessageCaptor = ArgumentCaptor.forClass(String.class); verify(mockedMailMessage).setText(stringMessageCaptor.capture()); String textInMessageBody = stringMessageCaptor.getValue(); assertTrue(textInMessageBody.contains("projectId1")); assertTrue(textInMessageBody.contains("base1")); assertTrue(textInMessageBody.contains("reason1")); assertTrue(textInMessageBody.contains("deleted")); }
@UseCaseAdministratorDeleteProject(@Step(number = 3, name = "Inform sechub admins that project has been deleted")) public void notify(ProjectMessage projectMessage, String baseUrl) { requireNonNull(projectMessage); SimpleMailMessage message = factory.createMessage("SecHub Project " + projectMessage.getProjectId() + " has been deleted"); message.setTo(notificationConfiguration.getEmailAdministrators()); message.setText(createEmailContent(projectMessage, baseUrl)); emailService.send(message); }
InformAdminsThatProjectHasBeenDeletedNotificationService { @UseCaseAdministratorDeleteProject(@Step(number = 3, name = "Inform sechub admins that project has been deleted")) public void notify(ProjectMessage projectMessage, String baseUrl) { requireNonNull(projectMessage); SimpleMailMessage message = factory.createMessage("SecHub Project " + projectMessage.getProjectId() + " has been deleted"); message.setTo(notificationConfiguration.getEmailAdministrators()); message.setText(createEmailContent(projectMessage, baseUrl)); emailService.send(message); } }
InformAdminsThatProjectHasBeenDeletedNotificationService { @UseCaseAdministratorDeleteProject(@Step(number = 3, name = "Inform sechub admins that project has been deleted")) public void notify(ProjectMessage projectMessage, String baseUrl) { requireNonNull(projectMessage); SimpleMailMessage message = factory.createMessage("SecHub Project " + projectMessage.getProjectId() + " has been deleted"); message.setTo(notificationConfiguration.getEmailAdministrators()); message.setText(createEmailContent(projectMessage, baseUrl)); emailService.send(message); }  }
InformAdminsThatProjectHasBeenDeletedNotificationService { @UseCaseAdministratorDeleteProject(@Step(number = 3, name = "Inform sechub admins that project has been deleted")) public void notify(ProjectMessage projectMessage, String baseUrl) { requireNonNull(projectMessage); SimpleMailMessage message = factory.createMessage("SecHub Project " + projectMessage.getProjectId() + " has been deleted"); message.setTo(notificationConfiguration.getEmailAdministrators()); message.setText(createEmailContent(projectMessage, baseUrl)); emailService.send(message); }  @UseCaseAdministratorDeleteProject(@Step(number = 3, name = "Inform sechub admins that project has been deleted")) void notify(ProjectMessage projectMessage, String baseUrl); }
InformAdminsThatProjectHasBeenDeletedNotificationService { @UseCaseAdministratorDeleteProject(@Step(number = 3, name = "Inform sechub admins that project has been deleted")) public void notify(ProjectMessage projectMessage, String baseUrl) { requireNonNull(projectMessage); SimpleMailMessage message = factory.createMessage("SecHub Project " + projectMessage.getProjectId() + " has been deleted"); message.setTo(notificationConfiguration.getEmailAdministrators()); message.setText(createEmailContent(projectMessage, baseUrl)); emailService.send(message); }  @UseCaseAdministratorDeleteProject(@Step(number = 3, name = "Inform sechub admins that project has been deleted")) void notify(ProjectMessage projectMessage, String baseUrl);  }