Search in sources :

Example 56 with LocalDate

use of org.joda.time.LocalDate in project head by mifos.

the class StandardAccountServiceTest method testDisbursalAmountScaleDifferenceDoesNotMatter.

@Test
public void testDisbursalAmountScaleDifferenceDoesNotMatter() throws Exception {
    when(mockLoanAccount.getLoanAmount()).thenReturn(new Money(TestUtils.EURO, "300"));
    AccountPaymentParametersDto disbursal = new AccountPaymentParametersDto(new UserReferenceDto((short) 1), new AccountReferenceDto(1), new BigDecimal("300.0000000000000"), new LocalDate(), new PaymentTypeDto((short) 1, "CASH"), "");
    List<InvalidPaymentReason> errors = new ArrayList<InvalidPaymentReason>();
    standardAccountService.disbursalAmountMatchesFullLoanAmount(disbursal.getPaymentAmount(), errors, mockLoanAccount);
    assertThat(errors.isEmpty(), is(true));
}
Also used : UserReferenceDto(org.mifos.dto.domain.UserReferenceDto) Money(org.mifos.framework.util.helpers.Money) AccountReferenceDto(org.mifos.dto.domain.AccountReferenceDto) ArrayList(java.util.ArrayList) AccountPaymentParametersDto(org.mifos.dto.domain.AccountPaymentParametersDto) PaymentTypeDto(org.mifos.dto.domain.PaymentTypeDto) LocalDate(org.joda.time.LocalDate) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 57 with LocalDate

use of org.joda.time.LocalDate in project head by mifos.

the class AccountRegenerateScheduleIntegrationTestCase method testChangeThirdThursdayMonthlyMeetingScheduleOnADateInFirstMonthAfterMeetingDate.

@Test
public // original schedule 11/20/08, 12/18/08, 1/15/09, 2/19/09, 3/19/09, 4/16/09
void testChangeThirdThursdayMonthlyMeetingScheduleOnADateInFirstMonthAfterMeetingDate() throws Exception {
    List<LocalDate> expectedMeetingDates = new ArrayList<LocalDate>();
    expectedMeetingDates.add(new LocalDate(2008, NOVEMBER, 20));
    expectedMeetingDates.add(new LocalDate(2008, DECEMBER, 2));
    expectedMeetingDates.add(new LocalDate(2009, JANUARY, 6));
    expectedMeetingDates.add(new LocalDate(2009, FEBRUARY, 3));
    expectedMeetingDates.add(new LocalDate(2009, MARCH, 3));
    expectedMeetingDates.add(new LocalDate(2009, APRIL, 7));
    LocalDate startDate = new LocalDate(2008, NOVEMBER, 20);
    LocalDate dateWhenMeetingWillBeChanged = new LocalDate(2008, NOVEMBER, 30);
    MeetingBO meeting = setupMonthlyMeeting(startDate, 1, RankOfDay.THIRD, WeekDay.THURSDAY);
    MeetingBO newMeeting = TestObjectFactory.createMeeting(new MeetingBuilder().monthly().every(1).buildMonthlyFor(RankOfDay.FIRST, WeekDay.TUESDAY));
    testChangeInMeetingScheduleForDates(meeting, newMeeting, startDate, dateWhenMeetingWillBeChanged);
    validateSchedules(expectedMeetingDates);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) ArrayList(java.util.ArrayList) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 58 with LocalDate

use of org.joda.time.LocalDate in project head by mifos.

the class AccountRegenerateScheduleIntegrationTestCase method testChangeMeetingInLastWeekOfSchedule.

// a change in the last week of a schedule should not change the schedule
@Test
public void testChangeMeetingInLastWeekOfSchedule() throws Exception {
    List<LocalDate> expectedMeetingDates = new ArrayList<LocalDate>();
    expectedMeetingDates.add(new LocalDate(2008, MAY, 23));
    expectedMeetingDates.add(new LocalDate(2008, MAY, 30));
    expectedMeetingDates.add(new LocalDate(2008, JUNE, 6));
    expectedMeetingDates.add(new LocalDate(2008, JUNE, 13));
    expectedMeetingDates.add(new LocalDate(2008, JUNE, 20));
    expectedMeetingDates.add(new LocalDate(2008, JUNE, 27));
    LocalDate startDate = new LocalDate(2008, MAY, 23);
    LocalDate dateWhenMeetingWillBeChanged = new LocalDate(2008, JUNE, 25);
    MeetingBO meeting = setupWeeklyMeeting(startDate, EVERY_WEEK);
    MeetingBO newMeeting = TestObjectFactory.getNewMeeting(RecurrenceType.WEEKLY, EVERY_WEEK, MeetingType.CUSTOMER_MEETING, WeekDay.WEDNESDAY);
    testChangeInMeetingScheduleForDates(meeting, newMeeting, startDate, dateWhenMeetingWillBeChanged);
    validateSchedules(expectedMeetingDates);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) ArrayList(java.util.ArrayList) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 59 with LocalDate

use of org.joda.time.LocalDate in project head by mifos.

the class AccountRegenerateScheduleIntegrationTestCase method testChangeMonthlyMeetingScheduleOnADateInFirstMonthBeforeMeetingDate.

@Test
public void testChangeMonthlyMeetingScheduleOnADateInFirstMonthBeforeMeetingDate() throws Exception {
    List<LocalDate> expectedMeetingDates = new ArrayList<LocalDate>();
    expectedMeetingDates.add(new LocalDate(2008, APRIL, 9));
    expectedMeetingDates.add(new LocalDate(2008, MAY, 9));
    expectedMeetingDates.add(new LocalDate(2008, JUNE, 20));
    expectedMeetingDates.add(new LocalDate(2008, JULY, 20));
    expectedMeetingDates.add(new LocalDate(2008, AUGUST, 20));
    LocalDate startDate = new LocalDate(2008, APRIL, 9);
    LocalDate dateWhenMeetingWillBeChanged = new LocalDate(2008, MAY, 3);
    MeetingBO meeting = setupMonthlyMeeting(startDate, 1, 9);
    MeetingBO newMeeting = TestObjectFactory.createMeeting(new MeetingBuilder().monthly().every(1).buildMonthlyForDayNumber(20));
    testChangeInMeetingScheduleForDates(meeting, newMeeting, startDate, dateWhenMeetingWillBeChanged);
    validateSchedules(expectedMeetingDates);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) ArrayList(java.util.ArrayList) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) LocalDate(org.joda.time.LocalDate) Test(org.junit.Test)

Example 60 with LocalDate

use of org.joda.time.LocalDate in project head by mifos.

the class AccountRegenerateScheduleIntegrationTestCase method testChangeMeetingInFirstWeekOfSchedule.

/*
     * original schedule dates: 5/23, 5/30, 6/6, 6/13, 6/20, 6/27
     */
@Test
public void testChangeMeetingInFirstWeekOfSchedule() throws Exception {
    List<LocalDate> expectedMeetingDates = new ArrayList<LocalDate>();
    expectedMeetingDates.add(new LocalDate(2008, MAY, 23));
    expectedMeetingDates.add(new LocalDate(2008, MAY, 28));
    expectedMeetingDates.add(new LocalDate(2008, JUNE, 4));
    expectedMeetingDates.add(new LocalDate(2008, JUNE, 11));
    expectedMeetingDates.add(new LocalDate(2008, JUNE, 18));
    expectedMeetingDates.add(new LocalDate(2008, JUNE, 25));
    LocalDate startDate = new LocalDate(2008, MAY, 23);
    LocalDate dateWhenMeetingWillBeChanged = new LocalDate(2008, MAY, 25);
    MeetingBO meeting = setupWeeklyMeeting(startDate, EVERY_WEEK);
    MeetingBO newMeeting = TestObjectFactory.getNewMeeting(RecurrenceType.WEEKLY, EVERY_WEEK, MeetingType.CUSTOMER_MEETING, WeekDay.WEDNESDAY);
    testChangeInMeetingScheduleForDates(meeting, newMeeting, startDate, dateWhenMeetingWillBeChanged);
    validateSchedules(expectedMeetingDates);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) ArrayList(java.util.ArrayList) LocalDate(org.joda.time.LocalDate) 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