@Test public void testCalculateUnderrecoveryWithApplyFlag() { BreakUpInterval bi = createBreakupInterval(); RateAndCost ohRateItem = bi.getRateAndCosts().get(0); ohRateItem.setApplyRateFlag(false); KcServiceLocator.getService(BreakupIntervalService.class).calculate(bi); assertEquals(bi.getUnderRecovery(), new ScaleTwoDecimal(4050.00)); }
@Test public void testCalculateWithApplyFlag() { BreakUpInterval bi = createBreakupInterval(); RateAndCost rc = bi.getRateAndCosts().get(1); rc.setApplyRateFlag(false); bi.getRateAndCosts().get(2).setApplyRateFlag(false); KcServiceLocator.getService(BreakupIntervalService.class).calculate(bi); List<RateAndCost> rateAndCosts = bi.getRateAndCosts(); RateAndCost rateAndCost1 = rateAndCosts.get(0); validateResults(rateAndCost1, 2500, 500, 5000, 1000); RateAndCost rateAndCost2 = rateAndCosts.get(1); validateResults(rateAndCost2, 0, 0, 0, 0); RateAndCost rateAndCost3 = rateAndCosts.get(2); validateResults(rateAndCost3, 0, 0, 0, 0); RateAndCost rateAndCost4 = rateAndCosts.get(3); validateResults(rateAndCost4, 250, 50, 5000, 1000); RateAndCost rateAndCost5 = rateAndCosts.get(6); validateResults(rateAndCost5, 7.50, 1.50, 250, 50); RateAndCost rateAndCost6 = rateAndCosts.get(7); validateResults(rateAndCost6, 5, 1, 250, 50); }
/** * Test method for {@link * org.kuali.coeus.common.budget.framework.calculator.BreakupIntervalService#calculate(org.kuali.coeus.common.budget.impl.calculator.BreakUpInterval)}. */ @Test public void testCalculate() { BreakUpInterval bi = createBreakupInterval(); KcServiceLocator.getService(BreakupIntervalService.class).calculate(bi); List<RateAndCost> rateAndCosts = bi.getRateAndCosts(); RateAndCost rateAndCost1 = rateAndCosts.get(0); validateResults(rateAndCost1, 3375, 675, 6750, 1350); RateAndCost rateAndCost2 = rateAndCosts.get(1); validateResults(rateAndCost2, 1250, 250, 5000, 1000); RateAndCost rateAndCost3 = rateAndCosts.get(2); validateResults(rateAndCost3, 500, 100, 5000, 1000); RateAndCost rateAndCost4 = rateAndCosts.get(3); validateResults(rateAndCost4, 250, 50, 5000, 1000); RateAndCost rateAndCost5 = rateAndCosts.get(6); validateResults(rateAndCost5, 7.50, 1.50, 250, 50); RateAndCost rateAndCost6 = rateAndCosts.get(7); validateResults(rateAndCost6, 5, 1, 250, 50); }