@Test public void shouldSendEmail() throws Exception { sendEmailController.sendEmail(mail); verify(senderService).send(mail.getFromAddress(),mail.getToAddress(),mail.getSubject(),mail.getMessage()); }
@RequestMapping(value = "/send", method = RequestMethod.POST) @PreAuthorize(EmailRolesConstants.HAS_ANY_EMAIL_ROLE) @ResponseStatus(HttpStatus.OK) public void sendEmail(@RequestBody Mail email) throws EmailSendException { senderService.send(email.getFromAddress(), email.getToAddress(), email.getSubject(), email.getMessage()); }
SendEmailController { @RequestMapping(value = "/send", method = RequestMethod.POST) @PreAuthorize(EmailRolesConstants.HAS_ANY_EMAIL_ROLE) @ResponseStatus(HttpStatus.OK) public void sendEmail(@RequestBody Mail email) throws EmailSendException { senderService.send(email.getFromAddress(), email.getToAddress(), email.getSubject(), email.getMessage()); } }
SendEmailController { @RequestMapping(value = "/send", method = RequestMethod.POST) @PreAuthorize(EmailRolesConstants.HAS_ANY_EMAIL_ROLE) @ResponseStatus(HttpStatus.OK) public void sendEmail(@RequestBody Mail email) throws EmailSendException { senderService.send(email.getFromAddress(), email.getToAddress(), email.getSubject(), email.getMessage()); } SendEmailController(); @Autowired  SendEmailController(EmailSenderService senderService); }
SendEmailController { @RequestMapping(value = "/send", method = RequestMethod.POST) @PreAuthorize(EmailRolesConstants.HAS_ANY_EMAIL_ROLE) @ResponseStatus(HttpStatus.OK) public void sendEmail(@RequestBody Mail email) throws EmailSendException { senderService.send(email.getFromAddress(), email.getToAddress(), email.getSubject(), email.getMessage()); } SendEmailController(); @Autowired  SendEmailController(EmailSenderService senderService); @RequestMapping(value = "/send", method = RequestMethod.POST) @PreAuthorize(EmailRolesConstants.HAS_ANY_EMAIL_ROLE) @ResponseStatus(HttpStatus.OK) void sendEmail(@RequestBody Mail email); @ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.NOT_FOUND) @ResponseBody String handleException(Exception e); }
SendEmailController { @RequestMapping(value = "/send", method = RequestMethod.POST) @PreAuthorize(EmailRolesConstants.HAS_ANY_EMAIL_ROLE) @ResponseStatus(HttpStatus.OK) public void sendEmail(@RequestBody Mail email) throws EmailSendException { senderService.send(email.getFromAddress(), email.getToAddress(), email.getSubject(), email.getMessage()); } SendEmailController(); @Autowired  SendEmailController(EmailSenderService senderService); @RequestMapping(value = "/send", method = RequestMethod.POST) @PreAuthorize(EmailRolesConstants.HAS_ANY_EMAIL_ROLE) @ResponseStatus(HttpStatus.OK) void sendEmail(@RequestBody Mail email); @ExceptionHandler(Exception.class) @ResponseStatus(HttpStatus.NOT_FOUND) @ResponseBody String handleException(Exception e);  }