@Test public void testCreateMailFor() throws Throwable { PropertiesPerson person = new PropertiesPerson( "person", myPersonProps ); Email email = myClassUnderTest.createMailFor( person ); myLog.debug( "Created Mail: " + email ); Assert.assertNotNull( email ); Assert.assertEquals( THIS_IS_THE_SUBJECT, email.getSubject() ); Object content = Whitebox.getInternalState( email, "content" ); Assert.assertNotNull( content ); Assert.assertEquals( THIS_IS_THE_BODY, content ); List<InternetAddress> addresses = email.getToAddresses(); Assert.assertNotNull( addresses ); Assert.assertEquals( 1, addresses.size() ); }
public Email createMailFor( Person<?> aPerson ) throws SdiException { Email email = new SimpleEmail(); try { email.addTo( aPerson.getEMail() ); String subject = myMailTextResolver.getResolvedSubject( aPerson ); myLog.debug( "resolved subject: " + subject); email.setSubject( subject ); String body = myMailTextResolver.getResolvedBody( aPerson ); myLog.debug( "resolved body: " + body ); email.setMsg( body ); } catch ( EmailException t ) { throw new SdiException( "Problems setting up mail for " + aPerson.getEMail(), t, SdiException.EXIT_CODE_MAIL_ERROR ); } return email; }
MailCreator { public Email createMailFor( Person<?> aPerson ) throws SdiException { Email email = new SimpleEmail(); try { email.addTo( aPerson.getEMail() ); String subject = myMailTextResolver.getResolvedSubject( aPerson ); myLog.debug( "resolved subject: " + subject); email.setSubject( subject ); String body = myMailTextResolver.getResolvedBody( aPerson ); myLog.debug( "resolved body: " + body ); email.setMsg( body ); } catch ( EmailException t ) { throw new SdiException( "Problems setting up mail for " + aPerson.getEMail(), t, SdiException.EXIT_CODE_MAIL_ERROR ); } return email; } }
MailCreator { public Email createMailFor( Person<?> aPerson ) throws SdiException { Email email = new SimpleEmail(); try { email.addTo( aPerson.getEMail() ); String subject = myMailTextResolver.getResolvedSubject( aPerson ); myLog.debug( "resolved subject: " + subject); email.setSubject( subject ); String body = myMailTextResolver.getResolvedBody( aPerson ); myLog.debug( "resolved body: " + body ); email.setMsg( body ); } catch ( EmailException t ) { throw new SdiException( "Problems setting up mail for " + aPerson.getEMail(), t, SdiException.EXIT_CODE_MAIL_ERROR ); } return email; }  }
MailCreator { public Email createMailFor( Person<?> aPerson ) throws SdiException { Email email = new SimpleEmail(); try { email.addTo( aPerson.getEMail() ); String subject = myMailTextResolver.getResolvedSubject( aPerson ); myLog.debug( "resolved subject: " + subject); email.setSubject( subject ); String body = myMailTextResolver.getResolvedBody( aPerson ); myLog.debug( "resolved body: " + body ); email.setMsg( body ); } catch ( EmailException t ) { throw new SdiException( "Problems setting up mail for " + aPerson.getEMail(), t, SdiException.EXIT_CODE_MAIL_ERROR ); } return email; }  Email createMailFor( Person<?> aPerson ); void init(); }
MailCreator { public Email createMailFor( Person<?> aPerson ) throws SdiException { Email email = new SimpleEmail(); try { email.addTo( aPerson.getEMail() ); String subject = myMailTextResolver.getResolvedSubject( aPerson ); myLog.debug( "resolved subject: " + subject); email.setSubject( subject ); String body = myMailTextResolver.getResolvedBody( aPerson ); myLog.debug( "resolved body: " + body ); email.setMsg( body ); } catch ( EmailException t ) { throw new SdiException( "Problems setting up mail for " + aPerson.getEMail(), t, SdiException.EXIT_CODE_MAIL_ERROR ); } return email; }  Email createMailFor( Person<?> aPerson ); void init();  }