Search in sources :

Example 81 with MeetingBuilder

use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.

the class CenterValidationTest method cannotCreateCenterWithoutAMfiJoiningDate.

@Test
public void cannotCreateCenterWithoutAMfiJoiningDate() {
    // setup
    DateTime noJoiningDate = null;
    MeetingBuilder customerMeeting = new MeetingBuilder().customerMeeting();
    center = new CenterBuilder().withName("center1").withLoanOfficer(anyLoanOfficer()).with(customerMeeting).withMfiJoiningDate(noJoiningDate).build();
    // exercise test
    try {
        center.validate();
        fail("cannotCreateCenterWithoutAMfiJoiningDate");
    } catch (ApplicationException e) {
        assertThat(e.getKey(), is(CustomerConstants.MFI_JOINING_DATE_MANDATORY));
    }
}
Also used : ApplicationException(org.mifos.framework.exceptions.ApplicationException) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) DateTime(org.joda.time.DateTime) Test(org.junit.Test)

Example 82 with MeetingBuilder

use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.

the class CenterValidationTest method setupDependencies.

@Before
public void setupDependencies() {
    OfficeBO office = new OfficeBuilder().build();
    PersonnelBO loanOfficer = new PersonnelBuilder().asLoanOfficer().build();
    MeetingBO meeting = new MeetingBuilder().customerMeeting().build();
    center = new CenterBuilder().with(office).withLoanOfficer(loanOfficer).with(meeting).build();
}
Also used : OfficeBuilder(org.mifos.domain.builders.OfficeBuilder) PersonnelBuilder(org.mifos.domain.builders.PersonnelBuilder) OfficeBO(org.mifos.customers.office.business.OfficeBO) PersonnelBO(org.mifos.customers.personnel.business.PersonnelBO) MeetingBO(org.mifos.application.meeting.business.MeetingBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) Before(org.junit.Before)

Example 83 with MeetingBuilder

use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.

the class UpdateCustomerMeetingScheduleTest method throwsCheckedExceptionWhenUserDoesNotHavePermissionToEditMeetingSchedule.

@Test(expected = BusinessRuleException.class)
public void throwsCheckedExceptionWhenUserDoesNotHavePermissionToEditMeetingSchedule() throws Exception {
    // setup
    UserContext userContext = TestUtils.makeUser();
    MeetingBO newMeeting = new MeetingBuilder().build();
    newMeeting.updateDetails(userContext);
    // stubbing
    when(mockedCenter.getUserContext()).thenReturn(TestUtils.makeUser());
    doThrow(new BusinessRuleException(SecurityConstants.KEY_ACTIVITY_NOT_ALLOWED)).when(customerDao).checkPermissionForEditMeetingSchedule(userContext, mockedCenter);
    // exercise test
    customerService.updateCustomerMeetingSchedule(newMeeting, mockedCenter);
    // verification
    verify(customerDao).checkPermissionForEditMeetingSchedule(userContext, mockedCenter);
}
Also used : BusinessRuleException(org.mifos.service.BusinessRuleException) UserContext(org.mifos.security.util.UserContext) MeetingBO(org.mifos.application.meeting.business.MeetingBO) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) Test(org.junit.Test)

Example 84 with MeetingBuilder

use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.

the class CustomerAccountBOIntegrationTest method createInitialObjects.

private void createInitialObjects() {
    MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
    IntegrationTestObjectMother.saveMeeting(weeklyMeeting);
    center = new CenterBuilder().withNumberOfExistingCustomersInOffice(3).with(weeklyMeeting).withName("Center_Active_test").with(sampleBranchOffice()).withLoanOfficer(testUser()).build();
    IntegrationTestObjectMother.createCenter((CenterBO) center, weeklyMeeting);
    group = TestObjectFactory.createWeeklyFeeGroupUnderCenter("Group_Active_test", CustomerStatus.GROUP_ACTIVE, center);
}
Also used : MeetingBO(org.mifos.application.meeting.business.MeetingBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder)

Example 85 with MeetingBuilder

use of org.mifos.domain.builders.MeetingBuilder in project head by mifos.

the class CustomerAccountCreationTest method firstCustomerScheduleIsAlwaysTheClosestMatchingDayOfWeekAndDoesNotTakeIntoAccountMonthlyMeetingFrequency.

@Test
public void firstCustomerScheduleIsAlwaysTheClosestMatchingDayOfWeekAndDoesNotTakeIntoAccountMonthlyMeetingFrequency() throws Exception {
    // setup
    applicableCalendarEvents = new CalendarEventBuilder().build();
    DateTime tue19thOfApril = new DateTime().withDate(2011, 4, 19);
    accountFees = new ArrayList<AccountFeesEntity>();
    MeetingBO centerMeeting = new MeetingBuilder().customerMeeting().monthly().every(2).occuringOnA(WeekDay.MONDAY).startingFrom(tue19thOfApril.minusDays(1).toDate()).onDayOfMonth(18).build();
    CenterBO center = new CenterBuilder().active().withActivationDate(tue19thOfApril).with(centerMeeting).build();
    // exercise test
    CustomerAccountBO centerAccount = CustomerAccountBO.createNew(center, accountFees, centerMeeting, applicableCalendarEvents);
    // verification
    List<AccountActionDateEntity> centerSchedules = new ArrayList<AccountActionDateEntity>(centerAccount.getAccountActionDates());
    LocalDate firstCenterDate = new LocalDate(centerSchedules.get(0).getActionDate());
    LocalDate mon18thOfMay = new DateTime().withDate(2011, 5, 18).toLocalDate();
    assertThat(firstCenterDate, is(mon18thOfMay));
}
Also used : CustomerAccountBO(org.mifos.customers.business.CustomerAccountBO) MeetingBO(org.mifos.application.meeting.business.MeetingBO) ArrayList(java.util.ArrayList) CenterBO(org.mifos.customers.center.business.CenterBO) CenterBuilder(org.mifos.domain.builders.CenterBuilder) LocalDate(org.joda.time.LocalDate) CalendarEventBuilder(org.mifos.domain.builders.CalendarEventBuilder) DateTime(org.joda.time.DateTime) AccountActionDateEntity(org.mifos.accounts.business.AccountActionDateEntity) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) Test(org.junit.Test)

Aggregations

MeetingBuilder (org.mifos.domain.builders.MeetingBuilder)106 Test (org.junit.Test)74 MeetingBO (org.mifos.application.meeting.business.MeetingBO)74 CenterBuilder (org.mifos.domain.builders.CenterBuilder)73 DateTime (org.joda.time.DateTime)58 ArrayList (java.util.ArrayList)47 CenterBO (org.mifos.customers.center.business.CenterBO)43 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)38 LocalDate (org.joda.time.LocalDate)27 GroupBuilder (org.mifos.domain.builders.GroupBuilder)24 Before (org.junit.Before)21 PersonnelBO (org.mifos.customers.personnel.business.PersonnelBO)20 FeeBuilder (org.mifos.domain.builders.FeeBuilder)20 OfficeBO (org.mifos.customers.office.business.OfficeBO)19 ClientBuilder (org.mifos.domain.builders.ClientBuilder)15 AmountFeeBO (org.mifos.accounts.fees.business.AmountFeeBO)14 CalendarEventBuilder (org.mifos.domain.builders.CalendarEventBuilder)14 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)13 CustomerAccountBO (org.mifos.customers.business.CustomerAccountBO)11 Ignore (org.junit.Ignore)10