@Test public void testExecute() { final Long testId = 1L; final ServiceActionContext currentContext = new ServiceActionContext(testId, principalMock); context.checking(new Expectations() { { oneOf(principalMock).getAccountId(); will(returnValue("fordp")); } }); Long testReturn = (Long) sut.execute(currentContext); context.assertIsSatisfied(); assertEquals(testId, testReturn); Person personTest = personMapper.findByAccountId("fordp"); assertTrue(personTest.getOptOutVideos().contains(testId)); }
@SuppressWarnings("deprecation") @Override public Serializable execute(final PrincipalActionContext inActionContext) { Person currentUser = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); Long videoID = (Long) inActionContext.getParams(); HashSet<Long>vids = currentUser.getOptOutVideos(); vids.add(videoID); currentUser.setOptOutVideos(vids); return videoID; }
SetOptOutVideoExecution implements ExecutionStrategy<PrincipalActionContext> { @SuppressWarnings("deprecation") @Override public Serializable execute(final PrincipalActionContext inActionContext) { Person currentUser = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); Long videoID = (Long) inActionContext.getParams(); HashSet<Long>vids = currentUser.getOptOutVideos(); vids.add(videoID); currentUser.setOptOutVideos(vids); return videoID; } }
SetOptOutVideoExecution implements ExecutionStrategy<PrincipalActionContext> { @SuppressWarnings("deprecation") @Override public Serializable execute(final PrincipalActionContext inActionContext) { Person currentUser = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); Long videoID = (Long) inActionContext.getParams(); HashSet<Long>vids = currentUser.getOptOutVideos(); vids.add(videoID); currentUser.setOptOutVideos(vids); return videoID; } SetOptOutVideoExecution(final PersonMapper inPersonMapper); }
SetOptOutVideoExecution implements ExecutionStrategy<PrincipalActionContext> { @SuppressWarnings("deprecation") @Override public Serializable execute(final PrincipalActionContext inActionContext) { Person currentUser = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); Long videoID = (Long) inActionContext.getParams(); HashSet<Long>vids = currentUser.getOptOutVideos(); vids.add(videoID); currentUser.setOptOutVideos(vids); return videoID; } SetOptOutVideoExecution(final PersonMapper inPersonMapper); @SuppressWarnings("deprecation") @Override Serializable execute(final PrincipalActionContext inActionContext); }
SetOptOutVideoExecution implements ExecutionStrategy<PrincipalActionContext> { @SuppressWarnings("deprecation") @Override public Serializable execute(final PrincipalActionContext inActionContext) { Person currentUser = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); Long videoID = (Long) inActionContext.getParams(); HashSet<Long>vids = currentUser.getOptOutVideos(); vids.add(videoID); currentUser.setOptOutVideos(vids); return videoID; } SetOptOutVideoExecution(final PersonMapper inPersonMapper); @SuppressWarnings("deprecation") @Override Serializable execute(final PrincipalActionContext inActionContext);  }