Search in sources :

Example 76 with LocalDate

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));
}
Also used : MonthlyOnLastDayOfMonthInterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 77 with LocalDate

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));
}
Also used : MonthlyOnLastDayOfMonthInterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 78 with LocalDate

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));
}
Also used : MonthlyOnLastDayOfMonthInterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 79 with LocalDate

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));
}
Also used : MonthlyOnLastDayOfMonthInterestScheduledEvent(org.mifos.accounts.savings.interest.schedule.internal.MonthlyOnLastDayOfMonthInterestScheduledEvent) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 80 with LocalDate

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")));
}
Also used : SavingsProductBuilder(org.mifos.domain.builders.SavingsProductBuilder) SavingsAdjustmentDto(org.mifos.dto.domain.SavingsAdjustmentDto) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) SavingsBO(org.mifos.accounts.savings.business.SavingsBO) SavingsAccountBuilder(org.mifos.domain.builders.SavingsAccountBuilder) LocalDate(org.joda.time.LocalDate) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Aggregations

LocalDate (org.joda.time.LocalDate)1094 Test (org.testng.annotations.Test)553 BigDecimal (java.math.BigDecimal)401 DateTime (org.joda.time.DateTime)231 ArrayList (java.util.ArrayList)217 Test (org.junit.Test)187 Invoice (org.killbill.billing.invoice.api.Invoice)165 UUID (java.util.UUID)148 Account (org.killbill.billing.account.api.Account)139 InvoiceItem (org.killbill.billing.invoice.api.InvoiceItem)118 DefaultEntitlement (org.killbill.billing.entitlement.api.DefaultEntitlement)104 FixedPriceInvoiceItem (org.killbill.billing.invoice.model.FixedPriceInvoiceItem)101 RecurringInvoiceItem (org.killbill.billing.invoice.model.RecurringInvoiceItem)95 ExpectedInvoiceItemCheck (org.killbill.billing.beatrix.util.InvoiceChecker.ExpectedInvoiceItemCheck)85 DefaultInvoice (org.killbill.billing.invoice.model.DefaultInvoice)82 RepairAdjInvoiceItem (org.killbill.billing.invoice.model.RepairAdjInvoiceItem)71 ItemAdjInvoiceItem (org.killbill.billing.invoice.model.ItemAdjInvoiceItem)69 PlanPhaseSpecifier (org.killbill.billing.catalog.api.PlanPhaseSpecifier)63 Date (java.util.Date)57 MockPlan (org.killbill.billing.catalog.MockPlan)52