use of org.mifos.customers.personnel.business.PersonnelBO in project head by mifos.
the class CenterCreationUsingCustomerServiceIntegrationTest method canNotCreateCenterWithNameOfAlreadyExistingCenter.
@Test(expected = BusinessRuleException.class)
public void canNotCreateCenterWithNameOfAlreadyExistingCenter() throws Exception {
// minimal details
MeetingBuilder aWeeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday();
String centerName = "existingCenterName";
OfficeBO anExistingBranch = sampleBranchOffice();
PersonnelBO existingLoanOfficer = testUser();
DateTime aWeekFromNow = new DateTime().plusWeeks(1);
CenterBO existingCenter = new CenterBuilder().withName(centerName).with(aWeeklyMeeting).with(anExistingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(aWeekFromNow).withUserContext().build();
IntegrationTestObjectMother.createCenter(existingCenter, existingCenter.getCustomerMeetingValue());
CenterBO newCenter = new CenterBuilder().withName(existingCenter.getDisplayName()).with(aWeeklyMeeting).with(anExistingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(aWeekFromNow).withUserContext().build();
// setup
List<AccountFeesEntity> noCenterAccountFees = new ArrayList<AccountFeesEntity>();
// exercise test
customerService.createCenter(newCenter, newCenter.getCustomerMeetingValue(), noCenterAccountFees);
// verification
assertThat(existingCenter.getGlobalCustNum(), is(not(newCenter.getGlobalCustNum())));
assertThat(existingCenter.getDisplayName(), is(newCenter.getDisplayName()));
}
use of org.mifos.customers.personnel.business.PersonnelBO in project head by mifos.
the class CenterCreationUsingCustomerServiceIntegrationTest method canCreateCenterWithAddress.
@Test
public void canCreateCenterWithAddress() throws Exception {
// minimal details
MeetingBuilder aWeeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday();
String centerName = "Center-IntegrationTest";
OfficeBO anExistingBranch = sampleBranchOffice();
PersonnelBO existingLoanOfficer = testUser();
DateTime aWeekFromNow = new DateTime().plusWeeks(1);
CenterBO center = new CenterBuilder().withName(centerName).with(aWeeklyMeeting).with(anExistingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(aWeekFromNow).with(anAddress()).withUserContext().build();
List<AccountFeesEntity> noAccountFees = new ArrayList<AccountFeesEntity>();
// exercise test
customerService.createCenter(center, center.getCustomerMeetingValue(), noAccountFees);
// verification
assertThat(center.getCustomerId(), is(notNullValue()));
assertThat(center.getGlobalCustNum(), is(notNullValue()));
assertThat(center.getAddress(), is(notNullValue()));
}
use of org.mifos.customers.personnel.business.PersonnelBO in project head by mifos.
the class CenterCreationUsingCustomerServiceIntegrationTest method canCreateCenterWithFeeThatMatchesMeetingPeriod.
@Test
public void canCreateCenterWithFeeThatMatchesMeetingPeriod() throws Exception {
// minimal details
MeetingBuilder aWeeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday();
String centerName = "Center-IntegrationTest";
OfficeBO anExistingBranch = sampleBranchOffice();
PersonnelBO existingLoanOfficer = testUser();
DateTime aWeekFromNow = new DateTime().plusWeeks(1);
CenterBO center = new CenterBuilder().withName(centerName).with(aWeeklyMeeting).with(anExistingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(aWeekFromNow).withUserContext().build();
// setup
AmountFeeBO existingWeeklyFee = new FeeBuilder().with(aWeeklyMeeting).appliesToCenterOnly().with(anExistingBranch).build();
IntegrationTestObjectMother.saveFee(existingWeeklyFee);
AccountFeesEntity accountFee = new AccountFeesEntity(null, existingWeeklyFee, existingWeeklyFee.getFeeAmount().getAmountDoubleValue());
List<AccountFeesEntity> centerAccountFees = new ArrayList<AccountFeesEntity>();
centerAccountFees.add(accountFee);
// exercise test
customerService.createCenter(center, center.getCustomerMeetingValue(), centerAccountFees);
// verification
assertThat(center.getCustomerId(), is(notNullValue()));
assertThat(center.getGlobalCustNum(), is(notNullValue()));
assertThat(center.getCustomerAccount().getAccountFees().isEmpty(), is(false));
}
use of org.mifos.customers.personnel.business.PersonnelBO in project head by mifos.
the class CenterCreationUsingCustomerServiceIntegrationTest method canCreateCenterWithExternalIdThatAlreadyExistsForAnotherCenter.
@Test
public void canCreateCenterWithExternalIdThatAlreadyExistsForAnotherCenter() throws Exception {
// minimal details
MeetingBuilder aWeeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday();
OfficeBO anExistingBranch = sampleBranchOffice();
PersonnelBO existingLoanOfficer = testUser();
DateTime aWeekFromNow = new DateTime().plusWeeks(1);
String externalId = "xxx111";
CenterBO existingCenter = new CenterBuilder().withName("existingCenterName").withExternalId(externalId).with(aWeeklyMeeting).with(anExistingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(aWeekFromNow).withUserContext().build();
IntegrationTestObjectMother.createCenter(existingCenter, existingCenter.getCustomerMeetingValue());
CenterBO newCenter = new CenterBuilder().withName("newCenterName").withExternalId(externalId).with(aWeeklyMeeting).with(anExistingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(aWeekFromNow).withUserContext().build();
// setup
List<AccountFeesEntity> noCenterAccountFees = new ArrayList<AccountFeesEntity>();
// exercise test
customerService.createCenter(newCenter, newCenter.getCustomerMeetingValue(), noCenterAccountFees);
// verification
assertThat(existingCenter.getGlobalCustNum(), is(not(newCenter.getGlobalCustNum())));
assertThat(existingCenter.getExternalId(), is(newCenter.getExternalId()));
}
use of org.mifos.customers.personnel.business.PersonnelBO in project head by mifos.
the class CenterCreationUsingCustomerServiceIntegrationTest method canCreateCenterWithMfiJoiningDateInPast.
@Test
public void canCreateCenterWithMfiJoiningDateInPast() throws Exception {
// setup
// minimal details
String centerName = "Center-IntegrationTest";
OfficeBO existingBranch = sampleBranchOffice();
PersonnelBO existingLoanOfficer = testUser();
MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).startingToday().build();
DateTime aWeekAgo = new DateTime().minusWeeks(1);
CenterBO center = new CenterBuilder().withName(centerName).with(weeklyMeeting).with(existingBranch).withLoanOfficer(existingLoanOfficer).withMfiJoiningDate(aWeekAgo).withUserContext().build();
List<AccountFeesEntity> noAccountFees = new ArrayList<AccountFeesEntity>();
// exercise test
customerService.createCenter(center, weeklyMeeting, noAccountFees);
// verification
assertThat(center.getCustomerId(), is(notNullValue()));
assertThat(center.getGlobalCustNum(), is(notNullValue()));
}
Aggregations