@Test(expected = Exception.class) public void testGetTokenDataErrorDecrypt() { mockery.checking(new Expectations() { { oneOf(tokenEncoder).decode(TOKEN, KEY); will(returnValue(null)); } }); sut.getTokenData(TOKEN, KEY); mockery.assertIsSatisfied(); }
Map<String, Long> getTokenData(final String token, final byte[] key) { String tokenConent = tokenEncoder.decode(token, key); if (tokenConent == null) { throw new ValidationException("Cannot decrypt token for user."); } Map<String, Long> tokenData = tokenContentFormatter.parse(tokenConent); if (tokenData == null) { throw new ValidationException("Cannot parse token."); } return tokenData; }
MessageProcessor { Map<String, Long> getTokenData(final String token, final byte[] key) { String tokenConent = tokenEncoder.decode(token, key); if (tokenConent == null) { throw new ValidationException("Cannot decrypt token for user."); } Map<String, Long> tokenData = tokenContentFormatter.parse(tokenConent); if (tokenData == null) { throw new ValidationException("Cannot parse token."); } return tokenData; } }
MessageProcessor { Map<String, Long> getTokenData(final String token, final byte[] key) { String tokenConent = tokenEncoder.decode(token, key); if (tokenConent == null) { throw new ValidationException("Cannot decrypt token for user."); } Map<String, Long> tokenData = tokenContentFormatter.parse(tokenConent); if (tokenData == null) { throw new ValidationException("Cannot parse token."); } return tokenData; } 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 { Map<String, Long> getTokenData(final String token, final byte[] key) { String tokenConent = tokenEncoder.decode(token, key); if (tokenConent == null) { throw new ValidationException("Cannot decrypt token for user."); } Map<String, Long> tokenData = tokenContentFormatter.parse(tokenConent); if (tokenData == null) { throw new ValidationException("Cannot parse token."); } return tokenData; } 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 { Map<String, Long> getTokenData(final String token, final byte[] key) { String tokenConent = tokenEncoder.decode(token, key); if (tokenConent == null) { throw new ValidationException("Cannot decrypt token for user."); } Map<String, Long> tokenData = tokenContentFormatter.parse(tokenConent); if (tokenData == null) { throw new ValidationException("Cannot parse token."); } return tokenData; } 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);  }