On Tue, Mar 31, 2009 at 6:48 AM, tibi <t...@dds.nl> wrote: > list, > > i'm looking at the test coverage and in particular the classes which are > tested below 85%. > > i came across the MailEngine. there are these two methods: > /** > * Send a simple message based on a Velocity template. > * @param msg the message to populate > * @param templateName the Velocity template to use (relative to > classpath) > * @param model a map containing key/value pairs > */ > public void sendMessage(SimpleMailMessage msg, String templateName, > Map model) { > String result = null; > > try { > result = > VelocityEngineUtils.mergeTemplateIntoString(velocityEngine, > templateName, model); > } catch (VelocityException e) { > e.printStackTrace(); > log.error(e.getMessage()); > } > > msg.setText(result); > send(msg); > } > > /** > * Send a simple message with pre-populated values. > * @param msg the message to send > * @throws org.springframework.mail.MailException when SMTP server > is down > */ > public void send(SimpleMailMessage msg) throws MailException { > try { > mailSender.send(msg); > } catch (MailException ex) { > log.error(ex.getMessage()); > throw ex; > } > } > > i wonder in both methods, what is the use of the catching part? > with send (the last one) it only adds a logging (which will be done > where ever the thrown exception is caught. > and in the first one there will be send an empty message.... > > > in the test case i added this line: > // a null from should work > mailEngine.sendMessage(new String[] { > "f...@bar.com" > }, null, cpResource, emailBody, emailSubject, ATTACHMENT_NAME); > > so the null for from is tested too > > should i make a jira with phatch??
Yes, that would be great. Thanks, Matt > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net > For additional commands, e-mail: users-h...@appfuse.dev.java.net > >