示例#1
0
  public void testSuccessfulEditPreview() throws Exception {
    fee =
        TestObjectFactory.createOneTimeAmountFee(
            "One Time Fee", FeeCategory.ALLCUSTOMERS, "100", FeePayment.UPFRONT);
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, fee, request);
    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "manage");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();

    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "editPreview");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    addRequestParameter("amount", "200.0");
    addRequestParameter("feeStatus", FeeStatus.INACTIVE.getValue().toString());
    actionPerform();
    verifyNoActionErrors();
    verifyForward(ActionForwards.editPreview_success.toString());

    FeeActionForm actionForm = (FeeActionForm) request.getSession().getAttribute("feeactionform");
    Assert.assertEquals("200.0", actionForm.getAmount());
    Assert.assertEquals(FeeStatus.INACTIVE, actionForm.getFeeStatusValue());
    Assert.assertNull(actionForm.getRate());
    Assert.assertNull(actionForm.getFeeFormula());
  }
示例#2
0
  public void testSuccessfulManage_RateFee() throws Exception {
    fee =
        TestObjectFactory.createOneTimeRateFee(
            "One Time Fee", FeeCategory.ALLCUSTOMERS, 24.0, FeeFormula.AMOUNT, FeePayment.UPFRONT);
    request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
    SessionUtils.setAttribute(Constants.BUSINESS_KEY, fee, request);
    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "manage");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyNoActionMessages();
    verifyForward(ActionForwards.manage_success.toString());

    FeeActionForm actionForm = (FeeActionForm) request.getSession().getAttribute("feeactionform");
    Assert.assertEquals("24.0", actionForm.getRate());
    Assert.assertEquals(FeeFormula.AMOUNT.getValue().toString(), actionForm.getFeeFormula());
    Assert.assertNull(actionForm.getAmount());

    Assert.assertEquals(
        "The size of master data for status",
        2,
        ((List<MasterDataEntity>) SessionUtils.getAttribute(FeeConstants.STATUSLIST, request))
            .size());
  }