public void testSuccessfulCreateOneTimeFee() throws Exception {
    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "load");
    actionPerform();
    flowKey = request.getAttribute(Constants.CURRENTFLOWKEY).toString();
    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("categoryType", FeeCategory.ALLCUSTOMERS.getValue().toString());
    addRequestParameter("currencyId", TestUtils.RUPEE.getCurrencyId().toString());
    addRequestParameter("amount", "100");
    addRequestParameter("feeName", "Customer_One_time");
    addRequestParameter("feeFrequencyType", FeeFrequencyType.ONETIME.getValue().toString());
    addRequestParameter("customerCharge", FeePayment.UPFRONT.getValue().toString());
    addRequestParameter("glCode", GLOCDE_ID);
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "create");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyForward(ActionForwards.create_success.toString());

    FeeActionForm actionForm = (FeeActionForm) request.getSession().getAttribute("feeactionform");
    fee = (FeeBO) TestObjectFactory.getObject(FeeBO.class, actionForm.getFeeIdValue());
    Assert.assertEquals("Customer_One_time", fee.getFeeName());
    Assert.assertEquals(FeeCategory.ALLCUSTOMERS.getValue(), fee.getCategoryType().getId());
    Assert.assertEquals(RateAmountFlag.AMOUNT, fee.getFeeType());
    Assert.assertEquals(new Money(getCurrency(), "100.0"), ((AmountFeeBO) fee).getFeeAmount());
    Assert.assertTrue(fee.isOneTime());
    Assert.assertFalse(fee.isCustomerDefaultFee());
    Assert.assertTrue(fee.isActive());
  }
  public void testFailurePreviewWith_FeeFrequencyOneTime() throws Exception {
    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "preview");
    addRequestParameter("feeName", "CustomerFee");
    addRequestParameter("categoryType", FeeCategory.CENTER.getValue().toString());
    addRequestParameter("feeFrequencyType", FeeFrequencyType.ONETIME.getValue().toString());
    addRequestParameter("customerCharge", FeePayment.UPFRONT.getValue().toString());
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();

    Assert.assertEquals(2, getErrorSize());
    Assert.assertEquals("Fee Amount", 1, getErrorSize(FeeConstants.AMOUNT));
    Assert.assertEquals("Fee GlCode", 1, getErrorSize(FeeConstants.INVALID_GLCODE));
    verifyInputForward();
  }