### Question:
SignUpRequestedAdminNotificationService { @UseCaseUserSignup(@Step(number = 3, next = { Step.NO_NEXT_STEP }, name = "Email to admin", description = "A notification is send per email to admins that a new user signup has been created and waits for acceptance.")) public void notify(UserMessage userMessage) { StringBuilder emailContent = new StringBuilder(); emailContent.append("A user requested access to SecHub:\n"); emailContent.append("- Requested user id: " + userMessage.getUserId() + "\n"); emailContent.append("- Email address: " + userMessage.getEmailAdress() + "\n"); SimpleMailMessage message1 =factory.createMessage("SecHub signup requested: " + userMessage.getUserId()); message1.setTo(notificationConfiguration.getEmailAdministrators()); message1.setText(emailContent.toString()); emailService.send(message1); }  @UseCaseUserSignup(@Step(number = 3, next = { Step.NO_NEXT_STEP }, name = "Email to admin", description = "A notification is send per email to admins that a new user signup has been created and waits for acceptance.")) void notify(UserMessage userMessage);  }### Answer:
@Test public void sends_email_to_admins_containing_userid_and_email_from_event() throws Exception { when(mockedNotificationConfiguration.getEmailAdministrators()).thenReturn("adminMail"); SimpleMailMessage mockedMailMessage = mock(SimpleMailMessage.class); when(mockedMailMessageFactory.createMessage(any())).thenReturn(mockedMailMessage); UserMessage message = mock(UserMessage.class); when(message.getUserId()).thenReturn("schlaubi"); when(message.getEmailAdress()).thenReturn("schlau.schlumpf@schlumpfhausen.de"); serviceToTest.notify(message); 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("schlaubi")); assertTrue(textInMessageBody.contains("schlau.schlumpf@schlumpfhausen.de")); }