@Test public void testAddStar() { SetActivityStarRequest currentRequest = new SetActivityStarRequest(1L, StarActionType.ADD_STAR); context.checking(new Expectations() { { oneOf(principalMock).getId(); will(returnValue(5L)); oneOf(starMapperMock).execute(with(any(StarredActivity.class))); } }); ServiceActionContext currentContext = new ServiceActionContext(currentRequest, principalMock); sut.execute(currentContext); context.assertIsSatisfied(); }
@Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { SetActivityStarRequest request = (SetActivityStarRequest) inActionContext.getParams(); StarredActivity starActivityData = new StarredActivity( inActionContext.getPrincipal().getId(), request.getActivityId()); return (request.getStarActionType() == StarActionType.ADD_STAR) ? insertStarredActivity.execute(starActivityData) : deleteStarredActivity.execute(starActivityData); }
SetActivityStarExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { SetActivityStarRequest request = (SetActivityStarRequest) inActionContext.getParams(); StarredActivity starActivityData = new StarredActivity( inActionContext.getPrincipal().getId(), request.getActivityId()); return (request.getStarActionType() == StarActionType.ADD_STAR) ? insertStarredActivity.execute(starActivityData) : deleteStarredActivity.execute(starActivityData); } }
SetActivityStarExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { SetActivityStarRequest request = (SetActivityStarRequest) inActionContext.getParams(); StarredActivity starActivityData = new StarredActivity( inActionContext.getPrincipal().getId(), request.getActivityId()); return (request.getStarActionType() == StarActionType.ADD_STAR) ? insertStarredActivity.execute(starActivityData) : deleteStarredActivity.execute(starActivityData); } SetActivityStarExecution(final InsertStarredActivity inInsertStarredActivity,
            final DeleteStarredActivity inDeleteStarredActivity); }
SetActivityStarExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { SetActivityStarRequest request = (SetActivityStarRequest) inActionContext.getParams(); StarredActivity starActivityData = new StarredActivity( inActionContext.getPrincipal().getId(), request.getActivityId()); return (request.getStarActionType() == StarActionType.ADD_STAR) ? insertStarredActivity.execute(starActivityData) : deleteStarredActivity.execute(starActivityData); } SetActivityStarExecution(final InsertStarredActivity inInsertStarredActivity,
            final DeleteStarredActivity inDeleteStarredActivity); @Override Serializable execute(final PrincipalActionContext inActionContext); }
SetActivityStarExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { SetActivityStarRequest request = (SetActivityStarRequest) inActionContext.getParams(); StarredActivity starActivityData = new StarredActivity( inActionContext.getPrincipal().getId(), request.getActivityId()); return (request.getStarActionType() == StarActionType.ADD_STAR) ? insertStarredActivity.execute(starActivityData) : deleteStarredActivity.execute(starActivityData); } SetActivityStarExecution(final InsertStarredActivity inInsertStarredActivity,
            final DeleteStarredActivity inDeleteStarredActivity); @Override Serializable execute(final PrincipalActionContext inActionContext);  }