DefaultWorldpaySupportService implements WorldpaySupportService { @Override public void sendSupportEmail() { final String emailAddress = configurationService.getConfiguration().getString(WORLDPAY_SUPPORT_EMAIL_CONFIG_KEY); final String emailDisplayName = configurationService.getConfiguration().getString(WORLDPAY_SUPPORT_EMAIL_DISPLAY_NAME_KEY); final String customerEmailAddress = configurationService.getConfiguration().getString(CUSTOMER_EMAIL_CONFIG_KEY); final String customerEmailDisplayName = configurationService.getConfiguration().getString(CUSTOMER_EMAIL_DISPLAY_NAME_KEY); final String replyToAddress = configurationService.getConfiguration().getString(CUSTOMER_REPLY_TO_ADDRESS); final String subject = configurationService.getConfiguration().getString(EMAIL_SUBJECT_KEY); final Email email; try { email = getPreConfiguredEmail(); email.addTo(emailAddress, emailDisplayName); email.setFrom(customerEmailAddress, customerEmailDisplayName); email.addReplyTo(replyToAddress); email.setSubject(subject); email.setMsg(worldpaySupportEmailService.createEmailBody()); email.send(); } catch (EmailException e) { LOG.error("Error creating or sending email", e); } }  @Override void sendSupportEmail(); @Required void setConfigurationService(final ConfigurationService configurationService); @Required void setWorldpaySupportEmailService(final WorldpaySupportEmailService worldpaySupportEmailService);  }
@Test public void testSendSupportEmail() throws Exception { testObj.sendSupportEmail(); verify(emailMock).addTo(WORLDPAY_SUPPORT_EMAIL_ADDRESS, WORLDPAY_SUPPORT_EMAIL_DISPLAY_NAME); verify(emailMock).setFrom(CUSTOMER_EMAIL_ADDRESS, CUSTOMER_EMAIL_DISPLAY_NAME); verify(emailMock).addReplyTo(REPLY_TO_ADDRESS); verify(emailMock).setSubject(SUBJECT); verify(emailMock).setMsg(EMAIL_BODY); verify(emailMock).send(); }