@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");
}