Пример #1
0
  public void testSuccessfulUpdate_AmountFee() 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();

    setRequestPathInfo("/feeaction.do");
    addRequestParameter("method", "update");
    addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
    actionPerform();
    verifyNoActionErrors();
    verifyForward(ActionForwards.update_success.toString());

    fee = (FeeBO) TestObjectFactory.getObject(FeeBO.class, fee.getFeeId());
    Assert.assertFalse(fee.isActive());
    Assert.assertEquals(new Money(getCurrency(), "200.0"), ((AmountFeeBO) fee).getFeeAmount());
  }
Пример #2
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());
  }