@Test public final void textPerformAction() throws Exception { final ExtendedUserDetails userMock = context.mock(ExtendedUserDetails.class); final String expectedUserName = "user"; final Person expectedPerson = context.mock(Person.class); context.checking(new Expectations() { { allowing(actionContext).getPrincipal(); will(returnValue(actionContextPrincipal)); allowing(actionContextPrincipal).getAccountId(); will(returnValue(expectedUserName)); oneOf(mapperMock).findByAccountId(expectedUserName); will(returnValue(expectedPerson)); oneOf(expectedPerson).setLastAcceptedTermsOfService(with(any(Date.class))); oneOf(mapperMock).flush(); } }); sut.execute(actionContext); context.assertIsSatisfied(); }
@Override public Serializable execute(final PrincipalActionContext inActionContext) { Person person = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); person.setLastAcceptedTermsOfService(new Date()); personMapper.flush(); return null; }
AcceptTermsOfServiceExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) { Person person = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); person.setLastAcceptedTermsOfService(new Date()); personMapper.flush(); return null; } }
AcceptTermsOfServiceExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) { Person person = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); person.setLastAcceptedTermsOfService(new Date()); personMapper.flush(); return null; } AcceptTermsOfServiceExecution(final PersonMapper inPersonMapper); }
AcceptTermsOfServiceExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) { Person person = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); person.setLastAcceptedTermsOfService(new Date()); personMapper.flush(); return null; } AcceptTermsOfServiceExecution(final PersonMapper inPersonMapper); @Override Serializable execute(final PrincipalActionContext inActionContext); }
AcceptTermsOfServiceExecution implements ExecutionStrategy<PrincipalActionContext> { @Override public Serializable execute(final PrincipalActionContext inActionContext) { Person person = personMapper.findByAccountId(inActionContext.getPrincipal().getAccountId()); person.setLastAcceptedTermsOfService(new Date()); personMapper.flush(); return null; } AcceptTermsOfServiceExecution(final PersonMapper inPersonMapper); @Override Serializable execute(final PrincipalActionContext inActionContext);  }