@Test public void execute() { final List<Long> activities = Arrays.asList(1L, 2L, 3L); sut = new GetActivityIDs(getIdsMock); final PrincipalActionContext actionContext = context.mock(PrincipalActionContext.class); final String request = "{}"; final Long userId = 1L; final Principal principle = context.mock(Principal.class); context.checking(new Expectations() { { oneOf(actionContext).getParams(); will(returnValue(request)); oneOf(actionContext).getPrincipal(); will(returnValue(principle)); oneOf(principle).getId(); will(returnValue(userId)); oneOf(getIdsMock).execute(request, userId); will(returnValue(activities)); } }); ArrayList<Long> result = (ArrayList<Long>) sut.execute(actionContext); Assert.assertEquals(activities, result); context.assertIsSatisfied(); }
@Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { ArrayList<Long> results = new ArrayList<Long>(getActivityIdsByJsonRequest.execute( (String) inActionContext.getParams(), inActionContext.getPrincipal().getId())); return results; }
GetActivityIDs implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { ArrayList<Long> results = new ArrayList<Long>(getActivityIdsByJsonRequest.execute( (String) inActionContext.getParams(), inActionContext.getPrincipal().getId())); return results; } }
GetActivityIDs implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { ArrayList<Long> results = new ArrayList<Long>(getActivityIdsByJsonRequest.execute( (String) inActionContext.getParams(), inActionContext.getPrincipal().getId())); return results; } GetActivityIDs(final GetActivityIdsByJson inGetActivityIdsByJsonRequest); }
GetActivityIDs implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { ArrayList<Long> results = new ArrayList<Long>(getActivityIdsByJsonRequest.execute( (String) inActionContext.getParams(), inActionContext.getPrincipal().getId())); return results; } GetActivityIDs(final GetActivityIdsByJson inGetActivityIdsByJsonRequest); @Override Serializable execute(final PrincipalActionContext inActionContext); }
GetActivityIDs implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException { ArrayList<Long> results = new ArrayList<Long>(getActivityIdsByJsonRequest.execute( (String) inActionContext.getParams(), inActionContext.getPrincipal().getId())); return results; } GetActivityIDs(final GetActivityIdsByJson inGetActivityIdsByJsonRequest); @Override Serializable execute(final PrincipalActionContext inActionContext);  }