use of org.mifos.reports.branchreport.persistence.BranchReportPersistence in project head by mifos.
the class BranchReportServiceIntegrationTest method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
branchReport = new BranchReportBO(BRANCH_ID_SHORT, RUN_DATE);
populateClientSummary();
populateLoanArrearSummary();
session = StaticHibernateUtil.getSessionTL();
// transaction = session.beginTransaction();
officeBusinessServiceMock = createMock(OfficeBusinessService.class);
branchReportService = new BranchReportService(officeBusinessServiceMock, new PersonnelBusinessService(), new BranchReportPersistence());
}
use of org.mifos.reports.branchreport.persistence.BranchReportPersistence in project head by mifos.
the class BranchReportServiceIntegrationTest method testResultsForStaffingLevelAreSorted.
@Test
public void testResultsForStaffingLevelAreSorted() throws PersistenceException, ServiceException {
BranchReportPersistence branchReportPersistenceMock = createMock(BranchReportPersistence.class);
branchReportService = new BranchReportService(officeBusinessServiceMock, new PersonnelBusinessService(), branchReportPersistenceMock);
ArrayList<BranchReportStaffingLevelSummaryBO> staffingLevelResult = new ArrayList<BranchReportStaffingLevelSummaryBO>();
BranchReportStaffingLevelSummaryBO totalStaffSummaryBO = new BranchReportStaffingLevelSummaryBO(IS_TOTAL, "A", 1);
staffingLevelResult.add(totalStaffSummaryBO);
staffingLevelResult.add(new BranchReportStaffingLevelSummaryBO(IS_NOT_TOTAL, "A", 1));
staffingLevelResult.add(new BranchReportStaffingLevelSummaryBO(IS_NOT_TOTAL, "B", 1));
expect(branchReportPersistenceMock.getBranchReportStaffingLevelSummary(BRANCH_ID_SHORT, RUN_DATE)).andReturn(staffingLevelResult);
replay(branchReportPersistenceMock);
List<BranchReportStaffingLevelSummaryBO> retrievedStaffingLevel = branchReportService.getStaffingLevelSummary(BRANCH_ID, RUN_DATE_STR);
verify(branchReportPersistenceMock);
BranchReportStaffingLevelSummaryBO lastBO = null;
for (BranchReportStaffingLevelSummaryBO summaryBO : retrievedStaffingLevel) {
if (lastBO != null) {
Assert.assertEquals(1, summaryBO.compareTo(lastBO));
}
lastBO = summaryBO;
}
Assert.assertEquals(0, totalStaffSummaryBO.compareTo(lastBO));
}
Aggregations