@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)); }
private RateAndCost getRateCost( String rateClassCode, String rateTypeCode, String rateClassType, double rate) { RateAndCost rateCost = new RateAndCost(); rateCost.setApplyRateFlag(true); rateCost.setRateClassType(rateClassType); rateCost.setRateClassCode(rateClassCode); rateCost.setRateTypeCode(rateTypeCode); rateCost.setAppliedRate(new ScaleTwoDecimal(rate)); rateCost.setCalculatedCost(ScaleTwoDecimal.ZERO); rateCost.setCalculatedCostSharing(ScaleTwoDecimal.ZERO); return rateCost; }
@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); }