@Test public void test() { final String tokenContent = "stuffToGoInTheToken"; final byte[] key = "key".getBytes(); mockery.checking(new Expectations() { { allowing(cryptoKeyDao).execute(PERSON_ID); will(returnValue(key)); allowing(tokenEncoder).encode(tokenContent, key); will(returnValue(TOKEN)); } }); String result = sut.build(tokenContent, PERSON_ID); mockery.assertIsSatisfied(); assertEquals(TO_ADDR_START + "+" + TOKEN + TO_ADDR_END, result); }
public String build(final String tokenContent, final long userId) { byte[] key = cryptoKeyDao.execute(userId); String token = tokenEncoder.encode(tokenContent, key); return toEmailStart + token + toEmailEnd; }
TokenContentEmailAddressBuilder { public String build(final String tokenContent, final long userId) { byte[] key = cryptoKeyDao.execute(userId); String token = tokenEncoder.encode(tokenContent, key); return toEmailStart + token + toEmailEnd; } }
TokenContentEmailAddressBuilder { public String build(final String tokenContent, final long userId) { byte[] key = cryptoKeyDao.execute(userId); String token = tokenEncoder.encode(tokenContent, key); return toEmailStart + token + toEmailEnd; } TokenContentEmailAddressBuilder(final TokenEncoder inTokenEncoder,
            final DomainMapper<Long, byte[]> inCryptoKeyDao, final String inToAddress); }
TokenContentEmailAddressBuilder { public String build(final String tokenContent, final long userId) { byte[] key = cryptoKeyDao.execute(userId); String token = tokenEncoder.encode(tokenContent, key); return toEmailStart + token + toEmailEnd; } TokenContentEmailAddressBuilder(final TokenEncoder inTokenEncoder,
            final DomainMapper<Long, byte[]> inCryptoKeyDao, final String inToAddress); String build(final String tokenContent, final long userId); }
TokenContentEmailAddressBuilder { public String build(final String tokenContent, final long userId) { byte[] key = cryptoKeyDao.execute(userId); String token = tokenEncoder.encode(tokenContent, key); return toEmailStart + token + toEmailEnd; } TokenContentEmailAddressBuilder(final TokenEncoder inTokenEncoder,
            final DomainMapper<Long, byte[]> inCryptoKeyDao, final String inToAddress); String build(final String tokenContent, final long userId);  }