Search in sources :

Example 1 with BranchReportLoanArrearsAgingBO

use of org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO in project head by mifos.

the class BranchReportHelperIntegrationTest method find.

private boolean find(BranchReportLoanArrearsAgingBO loanArrearsAging, List<BranchReportLoanArrearsAgingBO> retrievedLoanArrearsAgingReports) {
    boolean result = false;
    for (BranchReportLoanArrearsAgingBO bo : retrievedLoanArrearsAgingReports) {
        if (bo.getArrearsAgingId().equals(loanArrearsAging.getArrearsAgingId())) {
            Assert.assertEquals(bo.getPeriodDescription(), loanArrearsAging.getPeriodDescription());
            Assert.assertEquals(bo.getAgingPeriod(), loanArrearsAging.getAgingPeriod());
            bo.getAmountAging();
            // causes NPE at MoneyUtils.java:46
            loanArrearsAging.getAmountAging();
            Assert.assertEquals(bo.getAmountAging(), loanArrearsAging.getAmountAging());
            Assert.assertEquals(bo.getAmountOutstandingAging(), loanArrearsAging.getAmountOutstandingAging());
            result = true;
            return result;
        }
    }
    return result;
}
Also used : BranchReportLoanArrearsAgingBO(org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO)

Example 2 with BranchReportLoanArrearsAgingBO

use of org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO in project head by mifos.

the class BranchReportPersistenceIntegrationTest method testExtractingLoanArrears.

@Test
public void testExtractingLoanArrears() throws Exception {
    BranchReportLoanArrearsAgingBO result = branchReportPersistence.extractLoanArrearsAgingInfoInPeriod(LoanArrearsAgingPeriod.ONE_WEEK, Short.valueOf("2"), DEFAULT_CURRENCY);
    Assert.assertNotNull(result);
}
Also used : BranchReportLoanArrearsAgingBO(org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO) Test(org.junit.Test)

Example 3 with BranchReportLoanArrearsAgingBO

use of org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO in project head by mifos.

the class BranchReportPersistenceIntegrationTest method testSaveLoanArrearsBOWithLargeValueForAmountOutstanding.

@Test
public void testSaveLoanArrearsBOWithLargeValueForAmountOutstanding() throws Exception {
    BranchReportLoanArrearsAgingBO branchReportLoanArrearsAgingBO = new BranchReportLoanArrearsAgingBO(LoanArrearsAgingPeriod.FIVE_TO_EIGHT_WEEK, Integer.valueOf(1), Integer.valueOf(2), createMoney(TestUtils.RUPEE, 15724323.10), createMoney(TestUtils.RUPEE, 1283439.70), createMoney(TestUtils.RUPEE, 459625.70));
    BranchReportBO branchReport = BranchReportBOFixture.createBranchReport(null, Short.valueOf("2"), DateUtils.currentDate());
    branchReport.addLoanArrearsAging(branchReportLoanArrearsAgingBO);
    try {
        session.save(branchReport);
        session.flush();
        //            transaction = session.beginTransaction();
        deleteBranchReport(branchReport.getBranchReportId());
    } catch (Exception e) {
        e.printStackTrace(System.out);
        Assert.fail("Should not throw error when saving: " + e);
    }
}
Also used : BranchReportLoanArrearsAgingBO(org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO) BranchReportBO(org.mifos.reports.branchreport.BranchReportBO) PersistenceException(org.mifos.framework.exceptions.PersistenceException) Test(org.junit.Test)

Example 4 with BranchReportLoanArrearsAgingBO

use of org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO in project head by mifos.

the class BranchReportServiceIntegrationTest method testExtractLoanArrearsAgingInPeriod.

// TODO TW Add test data and have better test
@Test
public void testExtractLoanArrearsAgingInPeriod() throws Exception {
    BranchReportLoanArrearsAgingBO loanArrearsAgingInfoInPeriod = branchReportService.extractLoanArrearsAgingInfoInPeriod(BRANCH_ID_SHORT, LoanArrearsAgingPeriod.ONE_WEEK, DEFAULT_CURRENCY);
    Assert.assertNotNull(loanArrearsAgingInfoInPeriod);
// TODO TW more assertions based on test data
}
Also used : BranchReportLoanArrearsAgingBO(org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO) Test(org.junit.Test)

Example 5 with BranchReportLoanArrearsAgingBO

use of org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO in project head by mifos.

the class BranchReportLoanArrearsAgingHelper method populateLoanArrearsAging.

public void populateLoanArrearsAging() throws BatchJobException {
    LoanArrearsAgingPeriod[] values = LoanArrearsAgingPeriod.values();
    for (LoanArrearsAgingPeriod period : values) {
        try {
            BranchReportLoanArrearsAgingBO loanArrears = branchReportService.extractLoanArrearsAgingInfoInPeriod(branchReport.getBranchId(), period, branchReportConfigService.getCurrency());
            branchReport.addLoanArrearsAging(loanArrears);
        } catch (ServiceException e) {
            throw new BatchJobException(e);
        }
    }
}
Also used : BranchReportLoanArrearsAgingBO(org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO) LoanArrearsAgingPeriod(org.mifos.reports.branchreport.LoanArrearsAgingPeriod) BatchJobException(org.mifos.framework.components.batchjobs.exceptions.BatchJobException) ServiceException(org.mifos.framework.exceptions.ServiceException)

Aggregations

BranchReportLoanArrearsAgingBO (org.mifos.reports.branchreport.BranchReportLoanArrearsAgingBO)11 Test (org.junit.Test)5 BranchReportBO (org.mifos.reports.branchreport.BranchReportBO)2 BigDecimal (java.math.BigDecimal)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 List (java.util.List)1 Before (org.junit.Before)1 BatchJobException (org.mifos.framework.components.batchjobs.exceptions.BatchJobException)1 PersistenceException (org.mifos.framework.exceptions.PersistenceException)1 ServiceException (org.mifos.framework.exceptions.ServiceException)1 Money (org.mifos.framework.util.helpers.Money)1 MoneyUtils.createMoney (org.mifos.framework.util.helpers.MoneyUtils.createMoney)1 LoanArrearsAgingPeriod (org.mifos.reports.branchreport.LoanArrearsAgingPeriod)1