IndividualLoanAssembler implements LoanAssembler { @Override public IndividualLoan assembleFrom(IndividualLoanRequest individualLoan) { LoanOfferingBO loanProduct = this.loanProductDao.findBySystemId(individualLoan.getLoanProductId().globalIdentity()); ClientBO client = this.customerDao.findClientBySystemId(individualLoan.getClientId().globalIdentity()); int occurences = 12; DateTime lastScheduledDate = new DateTime(); ScheduledEvent scheduledEvent = scheduledEventFactory.createScheduledEventFrom(loanProduct.getLoanOfferingMeetingValue()); List<DateTime> loanScheduleDates = scheduledDateGeneration.generateScheduledDates(occurences, lastScheduledDate, scheduledEvent, false); Money loanAmount = null; Double interestRate = Double.valueOf("10.0"); Integer interestDays = Integer.valueOf(AccountingRules.getNumberOfInterestDays()); return new IndividualLoanImpl(); } IndividualLoanAssembler(LoanProductDao loanProductDao, CustomerDao customerDao, LoanScheduleFactory loanScheduleFactory,
            ScheduledDateGeneration scheduledDateGeneration, RecurringScheduledEventFactory scheduledEventFactory); @Override IndividualLoan assembleFrom(IndividualLoanRequest individualLoan);  }
@Test public void shouldRetrieveLoanProductWhenAssembling() { IndividualLoanRequest individualLoanRequest = new IndividualLoanRequestBuilder().with(loanProductId).build(); when(loanProductDao.findBySystemId(loanProductId.globalIdentity())).thenReturn(loanProduct); IndividualLoan individualLoan = loanAssembler.assembleFrom(individualLoanRequest); verify(loanProductDao).findBySystemId(loanProductId.globalIdentity()); assertThat(individualLoan, is(notNullValue())); }
@Test public void shouldRetrieveClientWhenAssembling() { IndividualLoanRequest individualLoanRequest = new IndividualLoanRequestBuilder().with(loanProductId) .with(clientId) .build(); when(loanProductDao.findBySystemId(loanProductId.globalIdentity())).thenReturn(loanProduct); loanAssembler.assembleFrom(individualLoanRequest); verify(customerDao).findClientBySystemId(clientId.globalIdentity()); }