AccountApplyPaymentAction extends BaseAction { @TransactionDemarcate(joinToken = true) public ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request, @SuppressWarnings("unused") HttpServletResponse response) throws Exception { UserContext userContext = getUserContext(request); AccountApplyPaymentActionForm actionForm = (AccountApplyPaymentActionForm) form; actionForm.setReceiptDate(null); actionForm.setReceiptId(null); actionForm.setPaymentTypeId(null); actionForm.setTransactionDate(DateUtils.makeDateAsSentFromBrowser()); actionForm.setPrintReceipt(false); actionForm.setTruePrintReceipt(false); final AccountReferenceDto accountReferenceDto = new AccountReferenceDto(Integer.valueOf(actionForm.getAccountId())); AccountPaymentDto accountPaymentDto = accountServiceFacade.getAccountPaymentInformation( accountReferenceDto.getAccountId(), request.getParameter(Constants.INPUT), userContext.getLocaleId(), new UserReferenceDto(userContext.getId()), DateUtils.getCurrentJavaDateTime()); setValuesInSession(request, actionForm, accountPaymentDto); actionForm.setLastPaymentDate(accountPaymentDto.getLastPaymentDate()); actionForm.setAmount(accountPaymentDto.getTotalPaymentDue()); actionForm.setTransferPaymentTypeId(this.legacyAcceptedPaymentTypeDao.getSavingsTransferId()); return mapping.findForward(ActionForwards.load_success.toString()); } AccountApplyPaymentAction(); @Deprecated // For unit testing  AccountApplyPaymentAction(AccountServiceFacade accountServiceFacade,
            LegacyAcceptedPaymentTypeDao legacyAcceptedPaymentTypeDao); @TransactionDemarcate(joinToken = true) ActionForward load(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            @SuppressWarnings("unused") HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward preview(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, @SuppressWarnings("unused") HttpServletRequest request,
            @SuppressWarnings("unused") HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward previous(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, @SuppressWarnings("unused") HttpServletRequest request,
            @SuppressWarnings("unused") HttpServletResponse response); @TransactionDemarcate(validateAndResetToken = true) @CloseSession ActionForward applyPayment(ActionMapping mapping, ActionForm form, HttpServletRequest request,
            @SuppressWarnings("unused") HttpServletResponse response); @TransactionDemarcate(validateAndResetToken = true) ActionForward cancel(ActionMapping mapping, ActionForm form, @SuppressWarnings("unused") HttpServletRequest request,
            @SuppressWarnings("unused") HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward validate(ActionMapping mapping, @SuppressWarnings("unused") ActionForm form, HttpServletRequest request,
            @SuppressWarnings("unused") HttpServletResponse response);  }
@Test public void loadShouldSetLastPaymentDateOnForm() throws Exception { when(accountServiceFacade.getAccountPaymentInformation(Matchers.<Integer>any(), Matchers.<String>any(), Matchers.<Short> any(), Matchers.<UserReferenceDto> any(), Matchers.<Date> any())).thenReturn( new AccountPaymentDto(null, 0, null, null, null, new Date(1234), null, null)); when(form.getAccountId()).thenReturn("1"); accountApplyPaymentAction = new AccountApplyPaymentAction(accountServiceFacade, legacyAcceptedPaymentTypeDao) { @Override protected UserContext getUserContext(HttpServletRequest request) { return userContext; } @Override void setValuesInSession(HttpServletRequest request, AccountApplyPaymentActionForm actionForm, AccountPaymentDto accountPaymentDto) throws PageExpiredException { } }; accountApplyPaymentAction.load(actionMapping, form, request, response); verify(form).setLastPaymentDate(new Date(1234)); }