use of org.mifos.domain.builders.GroupBuilder in project head by mifos.
the class GroupValidationTest method givenGroupWithNullMeetingShouldThrowBusinessRuleException.
@Test(expected = BusinessRuleException.class)
public void givenGroupWithNullMeetingShouldThrowBusinessRuleException() {
OfficeBO office = new OfficeBuilder().build();
PersonnelBO loanOfficer = new PersonnelBuilder().asLoanOfficer().build();
group = new GroupBuilder().withName("group-On-branch").withOffice(office).withLoanOfficer(loanOfficer).withMeeting(null).buildAsTopOfHierarchy();
}
use of org.mifos.domain.builders.GroupBuilder in project head by mifos.
the class GroupValidationTest method givenGroupWithNullParentShouldThrowIllegalArgumentException.
@Test(expected = IllegalArgumentException.class)
public void givenGroupWithNullParentShouldThrowIllegalArgumentException() {
OfficeBO office = new OfficeBuilder().build();
PersonnelBO loanOfficer = new PersonnelBuilder().asLoanOfficer().build();
MeetingBO meeting = new MeetingBuilder().customerMeeting().build();
group = new GroupBuilder().withName("group-On-center").withOffice(office).withLoanOfficer(loanOfficer).withMeeting(meeting).withParentCustomer(null).build();
}
use of org.mifos.domain.builders.GroupBuilder in project head by mifos.
the class GroupValidationTest method givenAnActiveLoanAccountExistsOnClientOfGroupGroupTransferToCenterShouldFailValidation.
@Test
public void givenAnActiveLoanAccountExistsOnClientOfGroupGroupTransferToCenterShouldFailValidation() {
// setup
CenterBO center = new CenterBuilder().build();
GroupBO group = new GroupBuilder().withParentCustomer(center).build();
ClientBO client = new ClientBuilder().withParentCustomer(group).active().buildForUnitTests();
group.addChild(client);
LoanBO loan = new LoanAccountBuilder().activeInGoodStanding().build();
client.addAccount(loan);
// exercise test
try {
group.validateNoActiveAccountsExist();
fail("should fail validation");
} catch (CustomerException e) {
assertThat(e.getKey(), is(CustomerConstants.ERRORS_CHILDREN_HAS_ACTIVE_ACCOUNT));
}
}
use of org.mifos.domain.builders.GroupBuilder in project head by mifos.
the class GroupValidationTest method givenCenterHasMeetingWithDifferentPeriodicityGroupTransferToCenterShouldFailValidation.
@Test
public void givenCenterHasMeetingWithDifferentPeriodicityGroupTransferToCenterShouldFailValidation() {
// setup
MeetingBO weeklyMeeting = new MeetingBuilder().customerMeeting().weekly().every(1).build();
CenterBO toCenter = new CenterBuilder().withName("receivingCenter").with(weeklyMeeting).build();
MeetingBO monthlyMeeting = new MeetingBuilder().customerMeeting().monthly().every(1).onDayOfMonth(1).build();
CenterBO oldCenter = new CenterBuilder().withName("oldCenter").with(monthlyMeeting).build();
GroupBO group = new GroupBuilder().withParentCustomer(oldCenter).build();
// exercise test
try {
group.validateReceivingCenter(toCenter);
fail("should fail validation");
} catch (CustomerException e) {
assertThat(e.getKey(), is(CustomerConstants.ERRORS_MEETING_FREQUENCY_MISMATCH));
}
}
use of org.mifos.domain.builders.GroupBuilder in project head by mifos.
the class GroupValidationTest method loanOfficerMustBeAssigned.
@Test
public void loanOfficerMustBeAssigned() {
OfficeBO office = new OfficeBuilder().build();
group = new GroupBuilder().withName("group-On-branch").withOffice(office).withLoanOfficer(null).buildAsTopOfHierarchy();
try {
group.validate();
fail("should throw customer exception as loan officer must exist when creating group under a branch.");
} catch (CustomerException e) {
assertThat(e.getKey(), is(CustomerConstants.ERRORS_SELECT_LOAN_OFFICER));
}
}
Aggregations