Search in sources :

Example 26 with SavingsOfferingBO

use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.

the class ReportProductOfferingServiceIntegrationTest method testGetSavingsOffering2ReturnsSavingsOffering.

@Test
public void testGetSavingsOffering2ReturnsSavingsOffering() throws Exception {
    SavingsOfferingBO savingsOffering2 = SavingsOfferingBO.createInstanceForTest(SAVINGS_OFFERING_2_ID);
    expect(savingsProductBusinessServiceMock.getSavingsProduct(SAVINGS_OFFERING_2_ID)).andReturn(savingsOffering2);
    replay(savingsProductBusinessServiceMock);
    SavingsOfferingBO retrievedSavingsOffering = reportProductOfferingService.getSavingsOffering2();
    verify(savingsProductBusinessServiceMock);
    Assert.assertEquals(savingsOffering2, retrievedSavingsOffering);
}
Also used : SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) Test(org.junit.Test)

Example 27 with SavingsOfferingBO

use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.

the class ReportProductOfferingServiceIntegrationTest method testGetSavingsOffering1ReturnsSavingsOffering.

@Test
public void testGetSavingsOffering1ReturnsSavingsOffering() throws Exception {
    SavingsOfferingBO savingsOffering1 = SavingsOfferingBO.createInstanceForTest(SAVINGS_OFFERING_1_ID);
    expect(savingsProductBusinessServiceMock.getSavingsProduct(SAVINGS_OFFERING_1_ID)).andReturn(savingsOffering1);
    replay(savingsProductBusinessServiceMock);
    SavingsOfferingBO retrievedSavingsOffering = reportProductOfferingService.getSavingsOffering1();
    verify(savingsProductBusinessServiceMock);
    Assert.assertEquals(savingsOffering1, retrievedSavingsOffering);
}
Also used : SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) Test(org.junit.Test)

Example 28 with SavingsOfferingBO

use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.

the class ClientCreationTest method throwsCheckedExceptionWhenValidationForDuplicateSavingsFails.

@Test(expected = CustomerException.class)
public void throwsCheckedExceptionWhenValidationForDuplicateSavingsFails() throws Exception {
    // setup
    List<AccountFeesEntity> accountFees = new ArrayList<AccountFeesEntity>();
    List<SavingsOfferingBO> noSavings = new ArrayList<SavingsOfferingBO>();
    // stubbing
    doThrow(new CustomerException(ClientConstants.ERRORS_DUPLICATE_OFFERING_SELECTED)).when(mockedClient).validateNoDuplicateSavings(noSavings);
    // exercise test
    customerService.createClient(mockedClient, meeting, accountFees, noSavings);
    // verify
    verify(mockedClient).validateNoDuplicateSavings(noSavings);
}
Also used : CustomerException(org.mifos.customers.exceptions.CustomerException) ArrayList(java.util.ArrayList) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) AccountFeesEntity(org.mifos.accounts.business.AccountFeesEntity) Test(org.junit.Test)

Example 29 with SavingsOfferingBO

use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.

the class CustomerPersistenceIntegrationTest method getSavingsAccount.

private AccountBO getSavingsAccount(final CustomerBO customer, final String prdOfferingname, final String shortName) throws Exception {
    Date startDate = new Date(System.currentTimeMillis());
    SavingsOfferingBO savingsOffering = TestObjectFactory.createSavingsProduct(prdOfferingname, shortName, startDate, RecommendedAmountUnit.COMPLETE_GROUP);
    return TestObjectFactory.createSavingsAccount("432434", customer, Short.valueOf("16"), startDate, savingsOffering);
}
Also used : SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) Date(java.sql.Date) LocalDate(org.joda.time.LocalDate)

Example 30 with SavingsOfferingBO

use of org.mifos.accounts.productdefinition.business.SavingsOfferingBO in project head by mifos.

the class SavingsIntPostingHelperIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    databaseCleaner.clean();
    DateTime startOfFiscalYear = new DateTime().withDate(2010, 1, 1);
    MeetingBO meetingFrequency = new MeetingBuilder().customerMeeting().startingFrom(startOfFiscalYear.toDate()).monthly().every(1).onDayOfMonth(1).build();
    createCenterGroupClientHierarchy(meetingFrequency);
    MeetingBO interestCalculationFrequency = new MeetingBuilder().savingsInterestCalulationSchedule().monthly().every(2).build();
    IntegrationTestObjectMother.saveMeeting(interestCalculationFrequency);
    MeetingBO interestPostingFrequency = new MeetingBuilder().savingsInterestPostingSchedule().monthly().every(2).build();
    IntegrationTestObjectMother.saveMeeting(interestPostingFrequency);
    SavingsOfferingBO mandatoryMinimumBalance = new SavingsProductBuilder().appliesToClientsOnly().withName("mandatoryMinimumBalance1").withShortName("mm01").mandatory().minimumBalance().withInterestCalculationSchedule(interestPostingFrequency).withInterestPostingSchedule(interestPostingFrequency).withMandatoryAmount("300").withInterestRate(Double.valueOf("12")).withMaxWithdrawalAmount(TestUtils.createMoney("200")).withMinAmountRequiredForInterestCalculation("200").buildForIntegrationTests();
    IntegrationTestObjectMother.saveSavingsProducts(mandatoryMinimumBalance);
    DateTime nextInterestPostingDate = new DateTime().minusDays(1);
    savings1 = new SavingsAccountBuilder().active().withSavingsProduct(mandatoryMinimumBalance).withCustomer(client).withCreatedBy(IntegrationTestObjectMother.testUser()).withActivationDate(startOfFiscalYear).withNextInterestPostingDateOf(nextInterestPostingDate).withBalanceOf(TestUtils.createMoney("0")).withDepositOn("300", startOfFiscalYear).withDepositOn("200", startOfFiscalYear.plusMonths(1)).build();
    IntegrationTestObjectMother.saveSavingsAccount(savings1);
}
Also used : SavingsProductBuilder(org.mifos.domain.builders.SavingsProductBuilder) MeetingBO(org.mifos.application.meeting.business.MeetingBO) SavingsOfferingBO(org.mifos.accounts.productdefinition.business.SavingsOfferingBO) MeetingBuilder(org.mifos.domain.builders.MeetingBuilder) SavingsAccountBuilder(org.mifos.domain.builders.SavingsAccountBuilder) DateTime(org.joda.time.DateTime) Before(org.junit.Before)

Aggregations

SavingsOfferingBO (org.mifos.accounts.productdefinition.business.SavingsOfferingBO)63 Test (org.junit.Test)33 ArrayList (java.util.ArrayList)20 SavingsBO (org.mifos.accounts.savings.business.SavingsBO)17 SavingsProductBuilder (org.mifos.domain.builders.SavingsProductBuilder)14 MeetingBO (org.mifos.application.meeting.business.MeetingBO)11 LocalDate (org.joda.time.LocalDate)10 SavingsAccountBuilder (org.mifos.domain.builders.SavingsAccountBuilder)10 Date (java.util.Date)9 UserContext (org.mifos.security.util.UserContext)9 Date (java.sql.Date)8 DateTime (org.joda.time.DateTime)8 AccountActionDateEntity (org.mifos.accounts.business.AccountActionDateEntity)8 AccountFeesEntity (org.mifos.accounts.business.AccountFeesEntity)8 SavingsTestHelper (org.mifos.accounts.savings.util.helpers.SavingsTestHelper)8 MifosRuntimeException (org.mifos.core.MifosRuntimeException)8 CustomerException (org.mifos.customers.exceptions.CustomerException)7 Money (org.mifos.framework.util.helpers.Money)7 AccountException (org.mifos.accounts.exceptions.AccountException)6 LoanOfferingBO (org.mifos.accounts.productdefinition.business.LoanOfferingBO)5