### Question:
EmailNotificationServiceImpl extends AbstractNotificationServiceImpl<EmailNotification> implements EmailNotificationService { @Transactional @Nonnull @Override public EmailNotification createEmailNotification(@Nonnull final EmailNotificationDto emailNotificationDto) { assertEmailNotificationDto(emailNotificationDto); LOGGER.debug("Creating email notification for DTO - {} and property dtos - {}", emailNotificationDto, emailNotificationDto.getProperties()); EmailNotification emailNotification = new EmailNotification(true); emailNotification.setFileAttachments(emailNotificationDto.getFileAttachments()); emailNotificationDto.updateDomainEntityProperties(emailNotification); emailNotification = emailNotificationRepository.save(emailNotification); associateNotificationWithUser(emailNotificationDto, emailNotification); LOGGER.debug("Successfully created email notification with id - {}, email notification - {}", emailNotification.getId(), emailNotification); return emailNotification; } EmailNotificationServiceImpl(); @Transactional @Nonnull @Override EmailNotification createEmailNotification(@Nonnull final EmailNotificationDto emailNotificationDto); @Override EmailNotification getEmailNotificationForProcessing(final Long notificationId); void setEmailNotificationRepository(final EmailNotificationRepository emailNotificationRepository);  }### Answer:
@Test public void testCreateEmailNotificationWithInvalidArguments() { final EmailNotificationDto emailNotificationDto = getServicesImplTestHelper().createEmailNotificationDto(); final List<NotificationPropertyDto> properties = getServicesImplTestHelper().createNotificationPropertyDtos(2); resetAll(); replayAll(); try { emailNotificationService.createEmailNotification(null); fail("Exception should be thrown"); } catch (final IllegalArgumentException ex) { } }
@Test public void testCreateEmailNotification_WhenUserUuidNull() { final EmailNotificationDto emailNotificationDto = getServicesImplTestHelper().createEmailNotificationDto(); final EmailNotification emailNotification = getServicesImplTestHelper().createEmailNotification(); emailNotification.setId(1L); resetAll(); expect(emailNotificationRepository.save(isA(EmailNotification.class))).andReturn(emailNotification); applicationEventDistributionService.publishAsynchronousEvent(new StartSendingNotificationEvent(emailNotification.getId(), emailNotificationDto.getProperties())); replayAll(); final EmailNotification result = emailNotificationService.createEmailNotification(emailNotificationDto); getServicesImplTestHelper().assertEmailNotification(result, emailNotificationDto); }