@Test public void test() { final String address = "system+token@eurekastreams.org"; final long userId = 8L; final long groupId = 6L; final String tokenContent = "stuffToGoInTheToken"; ExecutionStrategy<PrincipalActionContext> sut = new GetEmailAddressForStreamExecution(tokenContentFormatter, tokenAddressBuilder); mockery.checking(new Expectations() { { oneOf(tokenContentFormatter).buildForStream(EntityType.GROUP, groupId); will(returnValue(tokenContent)); oneOf(tokenAddressBuilder).build(tokenContent, userId); will(returnValue(address)); } }); Serializable result = sut.execute(TestContextCreator.createPrincipalActionContext(new EntityIdentifier( EntityType.GROUP, groupId), null, userId)); mockery.assertIsSatisfied(); assertEquals(address, result); }
@Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { EntityIdentifier params = (EntityIdentifier) inActionContext.getParams(); String tokenData = tokenContentFormatter.buildForStream(params.getType(), params.getId()); Long personId = inActionContext.getPrincipal().getId(); String address = tokenAddressBuilder.build(tokenData, personId); return address; }
GetEmailAddressForStreamExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { EntityIdentifier params = (EntityIdentifier) inActionContext.getParams(); String tokenData = tokenContentFormatter.buildForStream(params.getType(), params.getId()); Long personId = inActionContext.getPrincipal().getId(); String address = tokenAddressBuilder.build(tokenData, personId); return address; } }
GetEmailAddressForStreamExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { EntityIdentifier params = (EntityIdentifier) inActionContext.getParams(); String tokenData = tokenContentFormatter.buildForStream(params.getType(), params.getId()); Long personId = inActionContext.getPrincipal().getId(); String address = tokenAddressBuilder.build(tokenData, personId); return address; } GetEmailAddressForStreamExecution(final TokenContentFormatter inTokenContentFormatter,
            final TokenContentEmailAddressBuilder inTokenAddressBuilder); }
GetEmailAddressForStreamExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { EntityIdentifier params = (EntityIdentifier) inActionContext.getParams(); String tokenData = tokenContentFormatter.buildForStream(params.getType(), params.getId()); Long personId = inActionContext.getPrincipal().getId(); String address = tokenAddressBuilder.build(tokenData, personId); return address; } GetEmailAddressForStreamExecution(final TokenContentFormatter inTokenContentFormatter,
            final TokenContentEmailAddressBuilder inTokenAddressBuilder); @Override Serializable execute(final PrincipalActionContext inActionContext); }
GetEmailAddressForStreamExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { EntityIdentifier params = (EntityIdentifier) inActionContext.getParams(); String tokenData = tokenContentFormatter.buildForStream(params.getType(), params.getId()); Long personId = inActionContext.getPrincipal().getId(); String address = tokenAddressBuilder.build(tokenData, personId); return address; } GetEmailAddressForStreamExecution(final TokenContentFormatter inTokenContentFormatter,
            final TokenContentEmailAddressBuilder inTokenAddressBuilder); @Override Serializable execute(final PrincipalActionContext inActionContext);  }