use of org.mifos.framework.exceptions.ApplicationException in project head by mifos.
the class CenterValidationTest method cannotCreateCenterWithBlankName.
@Test
public void cannotCreateCenterWithBlankName() {
// setup
center = new CenterBuilder().withName("").build();
// exercise test
try {
center.validate();
fail("cannotCreateCenterWithBlankName");
} catch (ApplicationException e) {
assertThat(e.getKey(), is(CustomerConstants.ERRORS_SPECIFY_NAME));
}
}
use of org.mifos.framework.exceptions.ApplicationException in project head by mifos.
the class CenterValidationTest method cannotCreateCenterWithoutALoanOfficer.
@Test
public void cannotCreateCenterWithoutALoanOfficer() {
// setup
PersonnelBO noLoanOfficer = null;
center = new CenterBuilder().withName("center1").withLoanOfficer(noLoanOfficer).build();
// exercise test
try {
center.validate();
fail("cannotCreateCenterWithoutALoanOfficer");
} catch (ApplicationException e) {
assertThat(e.getKey(), is(CustomerConstants.ERRORS_SELECT_LOAN_OFFICER));
}
}
use of org.mifos.framework.exceptions.ApplicationException in project head by mifos.
the class CenterValidationTest method cannotCreateCenterWithoutAMeeting.
@Test
public void cannotCreateCenterWithoutAMeeting() {
// setup
MeetingBuilder noMeetingBuilder = null;
MeetingBO noMeeting = null;
center = new CenterBuilder().withName("center1").withLoanOfficer(anyLoanOfficer()).with(noMeeting).with(noMeetingBuilder).build();
List<AccountFeesEntity> noAccountFees = new ArrayList<AccountFeesEntity>();
// exercise test
try {
center.validateMeetingAndFees(noAccountFees);
fail("cannotCreateCenterWithoutAMeeting");
} catch (ApplicationException e) {
assertThat(e.getKey(), is(CustomerConstants.ERRORS_SPECIFY_MEETING));
}
}
use of org.mifos.framework.exceptions.ApplicationException in project head by mifos.
the class CenterValidationTest method cannotCreateCenterWithFeeThatHasDifferentPeriod.
@Test
public void cannotCreateCenterWithFeeThatHasDifferentPeriod() {
// setup
DateTime today = new DateTime();
MeetingBuilder aWeeklyMeeting = new MeetingBuilder().customerMeeting().weekly();
CenterBO center = new CenterBuilder().withName("center1").withLoanOfficer(anyLoanOfficer()).with(aWeeklyMeeting).withMfiJoiningDate(today).build();
MeetingBuilder aMonthlyMeeting = new MeetingBuilder().periodicFeeMeeting().monthly();
AmountFeeBO montlyPeriodicFee = new FeeBuilder().appliesToCenterOnly().with(aMonthlyMeeting).build();
AccountFeesEntity accountFee = new AccountFeesEntity(null, montlyPeriodicFee, montlyPeriodicFee.getFeeAmount().getAmountDoubleValue());
List<AccountFeesEntity> centerAccountFees = new ArrayList<AccountFeesEntity>();
centerAccountFees.add(accountFee);
// exercise test
try {
center.validateMeetingAndFees(centerAccountFees);
fail("cannotCreateCenterWithFeeThatHasDifferentPeriod");
} catch (ApplicationException e) {
assertThat(e.getKey(), is(CustomerConstants.ERRORS_FEE_FREQUENCY_MISMATCH));
}
}
use of org.mifos.framework.exceptions.ApplicationException in project head by mifos.
the class CenterValidationTest method cannotCreateCenterWithoutABranch.
@Test
public void cannotCreateCenterWithoutABranch() {
// setup
DateTime today = new DateTime();
MeetingBuilder customerMeeting = new MeetingBuilder().customerMeeting();
OfficeBO noBranch = null;
CenterBO center = new CenterBuilder().withName("center1").withLoanOfficer(anyLoanOfficer()).with(customerMeeting).withMfiJoiningDate(today).with(noBranch).build();
// exercise test
try {
center.validate();
fail("cannotCreateCenterWithoutABranch");
} catch (ApplicationException e) {
assertThat(e.getKey(), is(CustomerConstants.INVALID_OFFICE));
}
}
Aggregations