use of org.joda.time.LocalDate in project head by mifos.
the class MonthlyOnLastDayOfMonthInterestScheduledEventTest method shouldReturnFirstDateOfPeriodOfMatchingMonthlyDate.
@Test
public void shouldReturnFirstDateOfPeriodOfMatchingMonthlyDate() {
// setup
int every = 1;
monthlyEvent = new MonthlyOnLastDayOfMonthInterestScheduledEvent(every);
// exercise test
LocalDate nextValidMatchingDate = monthlyEvent.findFirstDateOfPeriodForMatchingDate(jun30th);
assertThat(nextValidMatchingDate, is(jun1st));
}
use of org.joda.time.LocalDate in project head by mifos.
the class MonthlyOnLastDayOfMonthInterestScheduledEventTest method shouldReturnFirstDateOfPeriodOfMatchingBiMonthlyDate.
@Test
public void shouldReturnFirstDateOfPeriodOfMatchingBiMonthlyDate() {
// setup
int every = 2;
monthlyEvent = new MonthlyOnLastDayOfMonthInterestScheduledEvent(every);
// exercise test
LocalDate nextValidMatchingDate = monthlyEvent.findFirstDateOfPeriodForMatchingDate(feb28th);
assertThat(nextValidMatchingDate, is(jan1st));
}
use of org.joda.time.LocalDate in project head by mifos.
the class MonthlyOnLastDayOfMonthInterestScheduledEventTest method shouldFindNearestMatchingDateAfterOrOnALegalEndOfMonthDate.
@Test
public void shouldFindNearestMatchingDateAfterOrOnALegalEndOfMonthDate() {
// setup
int every = 1;
monthlyEvent = new MonthlyOnLastDayOfMonthInterestScheduledEvent(every);
// exercise test
LocalDate nextMatchingDate = monthlyEvent.nextMatchingDateAfter(jan1st, jan31st);
assertThat(nextMatchingDate, is(jan31st));
}
use of org.joda.time.LocalDate in project head by mifos.
the class MonthlyOnLastDayOfMonthInterestScheduledEventTest method shouldReturnAllMatchingQuarterlyDatesStartingFromFiscalStartDateUpToCutOffDate.
@Test
public void shouldReturnAllMatchingQuarterlyDatesStartingFromFiscalStartDateUpToCutOffDate() {
// setup
int every = 3;
monthlyEvent = new MonthlyOnLastDayOfMonthInterestScheduledEvent(every);
// exercise test
List<LocalDate> nextValidMatchingDate = monthlyEvent.findAllMatchingDatesFromBaseDateUpToAndIncludingNearestMatchingEndDate(startOfFiscalYear, cutOffDate);
assertThat(nextValidMatchingDate, hasItem(mar31st));
assertThat(nextValidMatchingDate, hasItem(jun30th));
assertThat(nextValidMatchingDate, hasItem(sep30th));
assertThat(nextValidMatchingDate, hasItem(dec31st));
}
use of org.joda.time.LocalDate in project head by mifos.
the class SavingsAccountAdjustmentAndInterestCalculationServiceFacadeIntegrationTest method shouldHaveCorrectBalanceAfterDepositAndAdjustment.
@Test
public void shouldHaveCorrectBalanceAfterDepositAndAdjustment() throws Exception {
createCenterGroupClientHierarchy(aWeeklyMeeting);
SavingsOfferingBO savingsProduct = new SavingsProductBuilder().mandatory().withMandatoryAmount("33.0").appliesToClientsOnly().buildForIntegrationTests();
SavingsBO savingsAccount = new SavingsAccountBuilder().active().withActivationDate(mondayTwoWeeksAgo()).withSavingsProduct(savingsProduct).withCustomer(client).withCreatedBy(IntegrationTestObjectMother.testUser()).withBalanceOf(TestUtils.createMoney("0")).withDepositOn("20", new DateTime()).build();
IntegrationTestObjectMother.saveSavingsProductAndAssociatedSavingsAccounts(savingsProduct, savingsAccount);
Long savingsId = Long.valueOf(savingsAccount.getAccountId());
Double adjustedAmount = Double.valueOf("35");
String note = "I entered 20 but it should of being 35 which is an overpayment of the mandatory sum.";
SavingsAdjustmentDto savingsAdjustment = new SavingsAdjustmentDto(savingsId, adjustedAmount, note, savingsAccount.getLastPmnt().getPaymentId(), new LocalDate(savingsAccount.getLastPmnt().getPaymentDate()));
// exercise test
this.savingsServiceFacade.adjustTransaction(savingsAdjustment);
// verification
savingsAccount = IntegrationTestObjectMother.findSavingsAccountById(savingsId);
assertThat(savingsAccount.getSavingsBalance(), is(TestUtils.createMoney("35")));
}
Aggregations