use of org.mifos.domain.builders.SavingsAccountBuilder in project head by mifos.
the class SavingsAdjustmentTest method accountBalanceIsUpdatedWhenLastDepositIsAdjusted.
@Test
public void accountBalanceIsUpdatedWhenLastDepositIsAdjusted() {
savingsAccount = new SavingsAccountBuilder().active().withSavingsProduct(savingsProduct).withCustomer(client).withBalanceOf(TestUtils.createMoney("0")).withDepositOf("15").build();
Money amountAdjustedTo = TestUtils.createMoney("25");
String adjustmentNote = "testAdjustment";
PersonnelBO updatedBy = new PersonnelBuilder().build();
// pre verification
assertThat(savingsAccount.getSavingsBalance(), is(TestUtils.createMoney(15)));
// exercise test
savingsAccount.adjustLastUserAction(amountAdjustedTo, adjustmentNote, updatedBy);
// verification
assertThat(savingsAccount.getSavingsBalance(), is(TestUtils.createMoney(25)));
}
use of org.mifos.domain.builders.SavingsAccountBuilder in project head by mifos.
the class SavingsAdjustmentTest method accountBalanceIsUpdatedWhenLastWithdrawalIsAdjusted.
@Test
public void accountBalanceIsUpdatedWhenLastWithdrawalIsAdjusted() {
savingsAccount = new SavingsAccountBuilder().active().withSavingsProduct(savingsProduct).withCustomer(client).withBalanceOf(TestUtils.createMoney("100")).withWithdrawalOf("15").build();
Money amountAdjustedTo = TestUtils.createMoney("25");
String adjustmentNote = "testAdjustment";
PersonnelBO updatedBy = new PersonnelBuilder().build();
// pre verification
assertThat(savingsAccount.getSavingsBalance(), is(TestUtils.createMoney(85)));
// exercise test
savingsAccount.adjustLastUserAction(amountAdjustedTo, adjustmentNote, updatedBy);
// verification
assertThat(savingsAccount.getSavingsBalance(), is(TestUtils.createMoney(75)));
}
use of org.mifos.domain.builders.SavingsAccountBuilder in project head by mifos.
the class SavingsAdjustmentTest method cannotAdjustLastTransactionThatIsNotADepositOrWithdrawal.
@Test
public void cannotAdjustLastTransactionThatIsNotADepositOrWithdrawal() {
Money amountAdjustedTo = TestUtils.createMoney("25");
savingsAccount = new SavingsAccountBuilder().active().withSavingsProduct(savingsProduct).withCustomer(client).build();
// exercise test
boolean result = savingsAccount.isAdjustPossibleOnTrxn(amountAdjustedTo, savingsAccount.getLastPmnt());
// verification
assertFalse(result);
}
use of org.mifos.domain.builders.SavingsAccountBuilder in project head by mifos.
the class SavingsAdjustmentTest method cannotAdjustLastTransactionWhenItsAWithdrawalThatExceedsSavingsProductMaxWithdrawalAmount.
@Test
public void cannotAdjustLastTransactionWhenItsAWithdrawalThatExceedsSavingsProductMaxWithdrawalAmount() {
savingsProduct = new SavingsProductBuilder().mandatory().withMandatoryAmount("33.0").withMaxWithdrawalAmount(TestUtils.createMoney("50")).appliesToClientsOnly().buildForUnitTests();
savingsAccount = new SavingsAccountBuilder().active().withSavingsProduct(savingsProduct).withCustomer(client).withBalanceOf(TestUtils.createMoney("100")).withWithdrawalOf("15").build();
Money withdrawalAdjustment = TestUtils.createMoney("60");
// exercise test
boolean result = savingsAccount.isAdjustPossibleOnTrxn(withdrawalAdjustment, savingsAccount.getLastPmnt());
// verification
assertFalse(result);
}
use of org.mifos.domain.builders.SavingsAccountBuilder in project head by mifos.
the class SavingsAdjustmentTest method savingsPerformanceDetailsAreUpdatedWhenLastDepositIsAdjusted.
@Test
public void savingsPerformanceDetailsAreUpdatedWhenLastDepositIsAdjusted() {
savingsAccount = new SavingsAccountBuilder().active().withSavingsProduct(savingsProduct).withCustomer(client).withBalanceOf(TestUtils.createMoney("0")).withDepositOf("15").build();
Money amountAdjustedTo = TestUtils.createMoney("25");
String adjustmentNote = "testAdjustment";
PersonnelBO updatedBy = new PersonnelBuilder().build();
// pre verification
assertThat(savingsAccount.getSavingsPerformance().getTotalDeposits(), is(TestUtils.createMoney(15)));
// exercise test
savingsAccount.adjustLastUserAction(amountAdjustedTo, adjustmentNote, updatedBy);
// verification
assertThat(savingsAccount.getSavingsPerformance().getTotalDeposits(), is(TestUtils.createMoney(25)));
}
Aggregations