@Before public void setUp() { when(yazinoConfiguration.getBoolean(EmailService.PROPERTY_EMAIL_ENABLED, true)) .thenReturn(true); unit = new SimpleEmailService(mailSender, yazinoConfiguration); }
@Test public void shouldNotSendMessageWhenEmailEnabledPropertyIsPresentAndFalse() throws EmailException, MessagingException { reset(yazinoConfiguration); when(yazinoConfiguration.getBoolean(EmailService.PROPERTY_EMAIL_ENABLED, true)) .thenReturn(false); final Map<String, Object> templateProperties = new HashMap<String, Object>(); templateProperties.put("subject", "world"); unit.send(TO_EXAMPLE, FROM_ADDRESS_DEFAULT, SUBJECT_DEFAULT, "demo", templateProperties); verifyZeroInteractions(mailSender); }