@Test(expected = Exception.class) public void testGetFromNone2() throws MessagingException { mockery.checking(new Expectations() { { allowing(message).getFrom(); will(returnValue(null)); } }); sut.getFromAddress(message); mockery.assertIsSatisfied(); }
String getFromAddress(final Message message) throws MessagingException { Address[] addresses = message.getFrom(); if (addresses == null || addresses.length != 1 || addresses[0] == null) { throw new ValidationException("Message must contain a single From address."); } return ((InternetAddress) addresses[0]).getAddress(); }
MessageProcessor { String getFromAddress(final Message message) throws MessagingException { Address[] addresses = message.getFrom(); if (addresses == null || addresses.length != 1 || addresses[0] == null) { throw new ValidationException("Message must contain a single From address."); } return ((InternetAddress) addresses[0]).getAddress(); } }
MessageProcessor { String getFromAddress(final Message message) throws MessagingException { Address[] addresses = message.getFrom(); if (addresses == null || addresses.length != 1 || addresses[0] == null) { throw new ValidationException("Message must contain a single From address."); } return ((InternetAddress) addresses[0]).getAddress(); } MessageProcessor(final MessageContentExtractor inMessageContentExtractor,
            final ActionSelectorFactory inActionSelector, final ActionController inServiceActionController,
            final BeanFactory inBeanFactory, final TokenEncoder inTokenEncoder,
            final TokenContentFormatter inTokenContentFormatter, final PlatformTransactionManager inTransactionMgr,
            final DomainMapper<String, Long> inPersonIdByEmailDao, final DomainMapper<Long, byte[]> inUserKeyByIdDao,
            final DomainMapper<Long, PersonModelView> inPersonDao, final MessageReplier inMessageReplier,
            final String inRequiredToAddress); }
MessageProcessor { String getFromAddress(final Message message) throws MessagingException { Address[] addresses = message.getFrom(); if (addresses == null || addresses.length != 1 || addresses[0] == null) { throw new ValidationException("Message must contain a single From address."); } return ((InternetAddress) addresses[0]).getAddress(); } MessageProcessor(final MessageContentExtractor inMessageContentExtractor,
            final ActionSelectorFactory inActionSelector, final ActionController inServiceActionController,
            final BeanFactory inBeanFactory, final TokenEncoder inTokenEncoder,
            final TokenContentFormatter inTokenContentFormatter, final PlatformTransactionManager inTransactionMgr,
            final DomainMapper<String, Long> inPersonIdByEmailDao, final DomainMapper<Long, byte[]> inUserKeyByIdDao,
            final DomainMapper<Long, PersonModelView> inPersonDao, final MessageReplier inMessageReplier,
            final String inRequiredToAddress); boolean execute(final Message message, final List<Message> inResponseMessages); }
MessageProcessor { String getFromAddress(final Message message) throws MessagingException { Address[] addresses = message.getFrom(); if (addresses == null || addresses.length != 1 || addresses[0] == null) { throw new ValidationException("Message must contain a single From address."); } return ((InternetAddress) addresses[0]).getAddress(); } MessageProcessor(final MessageContentExtractor inMessageContentExtractor,
            final ActionSelectorFactory inActionSelector, final ActionController inServiceActionController,
            final BeanFactory inBeanFactory, final TokenEncoder inTokenEncoder,
            final TokenContentFormatter inTokenContentFormatter, final PlatformTransactionManager inTransactionMgr,
            final DomainMapper<String, Long> inPersonIdByEmailDao, final DomainMapper<Long, byte[]> inUserKeyByIdDao,
            final DomainMapper<Long, PersonModelView> inPersonDao, final MessageReplier inMessageReplier,
            final String inRequiredToAddress); boolean execute(final Message message, final List<Message> inResponseMessages);  }