use of java.util.Calendar in project head by mifos.
the class AccountBOIntegrationTest method offSetCurrentDate.
private java.sql.Date offSetCurrentDate(final int noOfDays) {
Calendar currentDateCalendar = new GregorianCalendar();
int year = currentDateCalendar.get(Calendar.YEAR);
int month = currentDateCalendar.get(Calendar.MONTH);
int day = currentDateCalendar.get(Calendar.DAY_OF_MONTH);
currentDateCalendar = new GregorianCalendar(year, month, day - noOfDays);
return new java.sql.Date(currentDateCalendar.getTimeInMillis());
}
use of java.util.Calendar in project head by mifos.
the class AccountBOIntegrationTest method testIsTrxnDateValid.
@Test
public void testIsTrxnDateValid() throws Exception {
Calendar calendar = new GregorianCalendar();
// Added by rajender on 24th July as test case was not passing
calendar.add(Calendar.DAY_OF_MONTH, 10);
java.util.Date trxnDate = new Date(calendar.getTimeInMillis());
Date meetingDate = new CustomerPersistence().getLastMeetingDateForCustomer(groupLoan.getCustomer().getCustomerId());
if (AccountingRules.isBackDatedTxnAllowed()) {
Assert.assertTrue(groupLoan.isTrxnDateValid(trxnDate, meetingDate, false));
} else {
Assert.assertFalse(groupLoan.isTrxnDateValid(trxnDate, meetingDate, false));
}
}
use of java.util.Calendar in project head by mifos.
the class CalendarTest method createPreviousDate.
private Date createPreviousDate(int numberOfDays) {
Calendar calendar = new GregorianCalendar();
calendar.setTime(new Date());
calendar.add(Calendar.DATE, -numberOfDays);
Date pastDate = DateUtils.getDateWithoutTimeStamp(calendar.getTime());
return pastDate;
}
use of java.util.Calendar in project head by mifos.
the class SavingsOfferingBOIntegrationTest method reduceCurrentDate.
private java.sql.Date reduceCurrentDate(final int noOfDays) {
Calendar currentDateCalendar = new GregorianCalendar();
int year = currentDateCalendar.get(Calendar.YEAR);
int month = currentDateCalendar.get(Calendar.MONTH);
int day = currentDateCalendar.get(Calendar.DAY_OF_MONTH);
currentDateCalendar = new GregorianCalendar(year, month, day - noOfDays);
return new java.sql.Date(currentDateCalendar.getTimeInMillis());
}
use of java.util.Calendar in project head by mifos.
the class SavingsOfferingBOIntegrationTest method offSetCurrentDate.
private java.sql.Date offSetCurrentDate(final int noOfDays) {
Calendar currentDateCalendar = new GregorianCalendar();
int year = currentDateCalendar.get(Calendar.YEAR);
int month = currentDateCalendar.get(Calendar.MONTH);
int day = currentDateCalendar.get(Calendar.DAY_OF_MONTH);
currentDateCalendar = new GregorianCalendar(year, month, day + noOfDays);
return new java.sql.Date(currentDateCalendar.getTimeInMillis());
}
Aggregations