use of org.mifos.framework.util.DateTimeService in project head by mifos.
the class ClientBoTest method testGetClientAttendanceForMeeting.
@Test
public void testGetClientAttendanceForMeeting() {
DateTime meetingDate = new DateTimeService().getCurrentDateTime();
client.addClientAttendance(buildClientAttendance(meetingDate.toDate()));
Assert.assertEquals("The value of customer attendance for the meeting : ", AttendanceType.PRESENT, client.getClientAttendanceForMeeting(meetingDate.toDate()).getAttendanceAsEnum());
}
use of org.mifos.framework.util.DateTimeService in project head by mifos.
the class ClientBoTest method testHandleAttendance.
@Test
public void testHandleAttendance() throws Exception {
DateTime meetingDate = new DateTimeService().getCurrentDateTime();
client.handleAttendance(meetingDate.toDate(), AttendanceType.PRESENT.getValue(), false);
Assert.assertEquals("The size of customer attendance is : ", client.getClientAttendances().size(), 1);
Assert.assertEquals("The value of customer attendance for the meeting : ", AttendanceType.PRESENT, client.getClientAttendanceForMeeting(meetingDate.toDate()).getAttendanceAsEnum());
client.handleAttendance(meetingDate.toDate(), AttendanceType.ABSENT.getValue(), false);
Assert.assertEquals("The size of customer attendance is : ", 1, client.getClientAttendances().size());
Assert.assertEquals("The value of customer attendance for the meeting : ", AttendanceType.ABSENT, client.getClientAttendanceForMeeting(meetingDate.toDate()).getAttendanceAsEnum());
}
use of org.mifos.framework.util.DateTimeService in project head by mifos.
the class ClientBoTest method testHandleAttendanceForDifferentDates.
@Test
public void testHandleAttendanceForDifferentDates() throws Exception {
DateTime meetingDate = new DateTimeService().getCurrentDateTime();
client.handleAttendance(meetingDate.toDate(), AttendanceType.PRESENT.getValue(), false);
Assert.assertEquals("The size of customer attendance is : ", client.getClientAttendances().size(), 1);
Assert.assertEquals("The value of customer attendance for the meeting : ", AttendanceType.PRESENT, client.getClientAttendanceForMeeting(meetingDate.toDate()).getAttendanceAsEnum());
DateMidnight offSetDate = getDateOffset(1);
client.handleAttendance(new java.sql.Date(offSetDate.getMillis()), AttendanceType.ABSENT.getValue(), false);
Assert.assertEquals("The size of customer attendance is : ", client.getClientAttendances().size(), 2);
Assert.assertEquals("The value of customer attendance for the meeting : ", AttendanceType.PRESENT, client.getClientAttendanceForMeeting(meetingDate.toDate()).getAttendanceAsEnum());
Assert.assertEquals("The value of customer attendance for the meeting : ", AttendanceType.ABSENT, client.getClientAttendanceForMeeting(offSetDate.toDate()).getAttendanceAsEnum());
}
use of org.mifos.framework.util.DateTimeService in project head by mifos.
the class LoanArrearsAgingHelperIntegrationTest method ageLoanAndGetLoanArrearsAgingEntity.
private LoanArrearsAgingEntity ageLoanAndGetLoanArrearsAgingEntity(LoanBO loan, int daysToAgeLoan) throws BatchJobException, PersistenceException {
Assert.assertNull(loan.getLoanArrearsAgingEntity());
new DateTimeService().setCurrentDateTimeFixed(dateTime.plusDays(daysToAgeLoan));
runLoanArrearsThenLoanArrearsAging();
StaticHibernateUtil.flushAndClearSession();
LoanBO reloadedLoan = legacyLoanDao.getAccount(loan.getAccountId());
return reloadedLoan.getLoanArrearsAgingEntity();
}
use of org.mifos.framework.util.DateTimeService in project head by mifos.
the class LoanArrearsAgingHelperIntegrationTest method testLoanWithOnePaymentMadeAndOneOverduePayments.
/**
* unsure why its failing.
*/
@Ignore
@Test
public void testLoanWithOnePaymentMadeAndOneOverduePayments() throws Exception {
LoanBO loan = setUpLoan(dateTime, AccountState.LOAN_ACTIVE_IN_GOOD_STANDING);
Assert.assertNull(loan.getLoanArrearsAgingEntity());
short daysOverdue = 3;
// advance time daysOverdue past the second repayment interval
dateTime = dateTime.plusDays(2 * repaymentInterval + daysOverdue);
new DateTimeService().setCurrentDateTimeFixed(dateTime);
// make one payment, so we should still be one payment behind after that
PaymentData paymentData = PaymentData.createPaymentData(new Money(Configuration.getInstance().getSystemConfig().getCurrency(), "" + onePayment), loan.getPersonnel(), Short.valueOf("1"), dateTime.toDate());
IntegrationTestObjectMother.applyAccountPayment(loan, paymentData);
runLoanArrearsThenLoanArrearsAging();
StaticHibernateUtil.flushAndClearSession();
loan = legacyLoanDao.getAccount(loan.getAccountId());
Assert.assertNotNull(loan.getLoanArrearsAgingEntity());
LoanArrearsAgingEntity loanArrearsAgingEntity = loan.getLoanArrearsAgingEntity();
Assert.assertEquals(new Money(getCurrency(), "" + (loanAmount - principalForOneInstallment)), loanArrearsAgingEntity.getUnpaidPrincipal());
Assert.assertEquals(new Money(getCurrency(), "" + (totalInterest - interestForOneInstallment)), loanArrearsAgingEntity.getUnpaidInterest());
Assert.assertEquals(new Money(getCurrency(), "" + principalForOneInstallment), loanArrearsAgingEntity.getOverduePrincipal());
Assert.assertEquals(new Money(getCurrency(), "" + interestForOneInstallment), loanArrearsAgingEntity.getOverdueInterest());
Assert.assertEquals(new Money(getCurrency(), "" + (principalForOneInstallment + interestForOneInstallment)), loanArrearsAgingEntity.getOverdueBalance());
Assert.assertEquals(Short.valueOf(daysOverdue), loanArrearsAgingEntity.getDaysInArrears());
}
Aggregations