LoanAccountAction extends AccountAppAction implements QuestionnaireAction { @TransactionDemarcate(joinToken = true) public ActionForward viewOriginalSchedule(final ActionMapping mapping, @SuppressWarnings("unused") final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response) throws Exception { UserContext userContext = getUserContext(request); Integer loanId = Integer.valueOf(request.getParameter(ACCOUNT_ID)); LoanBO loan = (LoanBO) SessionUtils.getAttribute(BUSINESS_KEY, request); boolean originalSchedule = ( request.getParameter("individual") == null ? true : false); OriginalScheduleInfoDto dto = loanServiceFacade.retrieveOriginalLoanSchedule(loanId); SessionUtils.setAttribute("originalSchedule", originalSchedule, request); SessionUtils.setAttribute(CustomerConstants.DISBURSEMENT_DATE, dto.getDisbursementDate(), request); SessionUtils.setAttribute(CustomerConstants.LOAN_AMOUNT, dto.getLoanAmount(), request); SessionUtils.setCollectionAttribute(LoanConstants.ORIGINAL_INSTALLMENTS, dto.getOriginalLoanScheduleInstallment(), request); return mapping.findForward(ActionForwards.viewOriginalSchedule.name()); } LoanAccountAction();  LoanAccountAction(final ConfigurationBusinessService configService,
                             final LoanBusinessService loanBusinessService, final GlimLoanUpdater glimLoanUpdater,
                             final LoanPrdBusinessService loanPrdBusinessService,
                             final ConfigurationPersistence configurationPersistence,
                             final AccountBusinessService accountBusinessService,
                             final GroupLoanAccountServiceFacade groupLoanAccountServiceFacade,
                             final InformationOrderServiceFacade informationOrderServiceFacade); @Deprecated  LoanAccountAction(final LoanBusinessService loanBusinessService, final ConfigurationBusinessService configService,
                      final GlimLoanUpdater glimLoanUpdater); @Deprecated private  LoanAccountAction(final ConfigurationBusinessService configService,
                              final LoanBusinessService loanBusinessService, final GlimLoanUpdater glimLoanUpdater); ActionForward viewAndEditAdditionalInformation(final ActionMapping mapping, @SuppressWarnings("unused") final ActionForm form, final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward getInstallmentDetails(final ActionMapping mapping,
                                               @SuppressWarnings("unused") final ActionForm form, final HttpServletRequest request,
                                               @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward getAllActivity(final ActionMapping mapping, @SuppressWarnings("unused") final ActionForm form,
                                        final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward forwardWaiveCharge(final ActionMapping mapping,
                                            @SuppressWarnings("unused") final ActionForm form, final HttpServletRequest request,
                                            @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(saveToken = true) ActionForward get(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request,
                             @SuppressWarnings("unused") final HttpServletResponse response); void setQuestionGroupInstances(QuestionnaireServiceFacade questionnaireServiceFacade, HttpServletRequest request, Integer loanAccountId); @TransactionDemarcate(saveToken = true) ActionForward getLoanRepaymentSchedule(final ActionMapping mapping,
                                                  final ActionForm form, final HttpServletRequest request,
                                                  @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward viewOriginalSchedule(final ActionMapping mapping,
                                              @SuppressWarnings("unused") final ActionForm form, final HttpServletRequest request,
                                              @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward viewStatusHistory(final ActionMapping mapping,
                                           @SuppressWarnings("unused") final ActionForm form, final HttpServletRequest request,
                                           @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward validate(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request,
                                  @SuppressWarnings("unused") final HttpServletResponse response); ActionForward redoLoanBegin(final ActionMapping mapping, @SuppressWarnings("unused") final ActionForm form,
                                       @SuppressWarnings("unused") final HttpServletRequest request,
                                       @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward manage(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request,
                                @SuppressWarnings("unused") final HttpServletResponse response); static void setSessionAtributeForGLIM(final HttpServletRequest request, LoanBO loanBO); @TransactionDemarcate(joinToken = true) ActionForward managePrevious(final ActionMapping mapping, @SuppressWarnings("unused") final ActionForm form,
                                        final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward managePreview(final ActionMapping mapping, final ActionForm form,
                                       final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(validateAndResetToken = true) ActionForward cancel(final ActionMapping mapping, @SuppressWarnings("unused") final ActionForm form,
                                @SuppressWarnings("unused") final HttpServletRequest request,
                                @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(validateAndResetToken = true) ActionForward update(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request,
                                @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) @Override ActionForward captureQuestionResponses(final ActionMapping mapping, final ActionForm form,
                                                  final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) @Override ActionForward editQuestionResponses(
            final ActionMapping mapping, final ActionForm form,
            final HttpServletRequest request, @SuppressWarnings("unused") final HttpServletResponse response); void setCustomerDao(CustomerDao customerDao); @TransactionDemarcate(saveToken = true) ActionForward getGroupLoanAccountDetails(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request,
                             @SuppressWarnings("unused") final HttpServletResponse response); @TransactionDemarcate(joinToken = true) ActionForward getGroupLoanRepaymentSchedule(final ActionMapping mapping,
                                                  final ActionForm form, final HttpServletRequest request,
                                                  @SuppressWarnings("unused") final HttpServletResponse response); ActionForward getDetails(final ActionMapping mapping, final ActionForm form, final HttpServletRequest request,
            @SuppressWarnings("unused") final HttpServletResponse response); static final String CUSTOMER_ID; static final String ACCOUNT_ID; static final String GLOBAL_ACCOUNT_NUM; }
@SuppressWarnings("unchecked") @Test public void shouldViewOriginalSchedule() throws Exception { ActionForward viewOriginalScheduleForward = new ActionForward("viewOriginalSchedule"); int loanId = 1; String loanAmount = "123"; List<RepaymentScheduleInstallment> installments = Collections.EMPTY_LIST; java.sql.Date disbursementDate = new java.sql.Date(new DateTime().toDate().getTime()); OriginalScheduleInfoDto dto = mock(OriginalScheduleInfoDto.class); when(dto.getOriginalLoanScheduleInstallment()).thenReturn(installments); when(dto.getLoanAmount()).thenReturn(loanAmount); when(dto.getDisbursementDate()).thenReturn(disbursementDate); when(request.getParameter(LoanAccountAction.ACCOUNT_ID)).thenReturn(String.valueOf(loanId)); when(loanServiceFacade.retrieveOriginalLoanSchedule(loanId)).thenReturn(dto); when(mapping.findForward("viewOriginalSchedule")).thenReturn(viewOriginalScheduleForward); ActionForward forward = loanAccountAction.viewOriginalSchedule(mapping, form, request, response); assertThat(forward, is(viewOriginalScheduleForward)); verify(request).getParameter(LoanAccountAction.ACCOUNT_ID); verify(loanServiceFacade).retrieveOriginalLoanSchedule(loanId); verify(dto).getOriginalLoanScheduleInstallment(); verify(dto).getLoanAmount(); verify(dto).getDisbursementDate(); verify(mapping).findForward("viewOriginalSchedule"); }