@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 method for {@link
  * org.kuali.coeus.common.budget.framework.calculator.BreakupIntervalService#calculate(org.kuali.coeus.common.budget.impl.calculator.BreakUpInterval)}.
  */
 @Test
 public void testCalculateOverrecovery() {
   BreakUpInterval bi1 = createBreakupInterval();
   bi1.setURRatesBean(
       getBudgetRate("1", 40, 1L, "2011", 40, true, "1", "2", "O", "07/01/2009", "000001"));
   KcServiceLocator.getService(BreakupIntervalService.class).calculate(bi1);
   assertEquals(bi1.getUnderRecovery(), new ScaleTwoDecimal(-810.0));
 }
 /**
  * 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);
 }
 @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);
 }
 private BreakUpInterval createBreakupInterval() {
   BreakUpInterval bi1 = new BreakUpInterval();
   bi1.setApplicableAmt(new ScaleTwoDecimal(5000));
   bi1.setApplicableAmtCostSharing(new ScaleTwoDecimal(1000));
   bi1.setBoundary(new Boundary(getDate("01/01/2010"), getDate("06/30/2010")));
   bi1.setBudgetPeriod(1);
   bi1.setBudgetId(1L);
   bi1.setBudgetProposalLaRates(getBudgetLArates());
   bi1.setBudgetProposalRates(getBudgetRates());
   bi1.setLineItemNumber(1);
   bi1.setRateAndCosts(createRateAndCosts());
   bi1.setRateNumber(1);
   return bi1;
 }