示例#1
0
  /**
   * Description:这里写描述<br>
   *
   * @author zouming
   * @version 0.1 2012-12-4上午9:08:48 void
   * @update 2012-12-4上午9:08:48
   */
  @Test
  public void testValidateRecompensePaymentRequire() {
    PaymentBill paymentBill = new PaymentBill();
    BankAccount bankAccount = new BankAccount();

    bankAccount.setBankName("德邦银行");
    bankAccount.setOpenName("德邦大爷");
    bankAccount.setAccount("008009001002");
    bankAccount.setProvince("天堂省");
    bankAccount.setCity("极乐城");
    bankAccount.setBranchName("德邦小弟银行");
    bankAccount.setMobile("0214008305555");

    paymentBill.setPaymentType("月结");
    paymentBill.setPaymentAmount(100d);
    paymentBill.setBankAccount(bankAccount);
    System.err.println(RecompenseValidator.validateRecompensePayment(paymentBill));

    paymentBill.setPaymentAmount(-100d);
    //		System.err.println();
    try {
      RecompenseValidator.validateRecompensePayment(paymentBill);
      fail("大人,未抛出异常。");
    } catch (GeneralException e) {
      if (e.getErrorCode()
          .equals(RecompenseExceptionType.RECOMPENSE_PAYMENT_AMOUNT_ERROR.getErrorCode())) {
        assertTrue(true);
      } else {
        fail("大人,异常不正确");
      }
    }
  }
示例#2
0
  @Test
  public void testValidateRecompensePayment() {
    boolean result = false;
    PaymentBill paymentBill = null;
    // 理赔单为空
    try {
      result = RecompenseValidator.validateRecompensePayment(paymentBill);
      fail("未抛出异常");
    } catch (GeneralException e) {
      if (e.getErrorCode()
          .equals(RecompenseExceptionType.RECOMPENSE_PAYMENT_NULL_ERROR.getErrorCode())) {
        assertTrue(true);
      } else {
        fail("抛出异常不正确");
      }
    }
    paymentBill = new PaymentBill();
    paymentBill.setPaymentType("现金");
    Finance finance = new Finance();
    paymentBill.setBelongfinance(finance);
    BankAccount bankAccount = new BankAccount();
    paymentBill.setBankAccount(bankAccount);

    // 理赔单金额为空
    try {
      result = RecompenseValidator.validateRecompensePayment(paymentBill);
      fail("未抛出异常");
    } catch (GeneralException e) {
      if (e.getErrorCode()
          .equals(RecompenseExceptionType.RECOMPENSE_PAYMENT_AMOUNT_ERROR.getErrorCode())) {
        assertTrue(true);
      } else {
        fail("抛出异常不正确");
      }
    }

    // PaymentAmount小于0
    paymentBill.setPaymentAmount(-213d);
    try {
      result = RecompenseValidator.validateRecompensePayment(paymentBill);
      fail("未抛出异常");
    } catch (GeneralException e) {
      System.err.println("xxxxx:" + e.getErrorCode());
      if (e.getErrorCode()
          .equals(RecompenseExceptionType.RECOMPENSE_PAYMENT_AMOUNT_ERROR.getErrorCode())) {
        assertTrue(true);
      } else {
        fail("抛出异常不正确");
      }
    }

    //
    paymentBill.setPaymentAmount(213d);
    // 理赔单数据不全
    try {
      result = RecompenseValidator.validateRecompensePayment(paymentBill);
      fail("未抛出异常");
    } catch (GeneralException e) {
      if (e.getErrorCode()
          .equals(RecompenseExceptionType.RECOMPENSE_PAYMENT_REQUIRE_ERROR.getErrorCode())) {
        assertTrue(true);
      } else {
        fail("抛出异常不正确");
      }
    }
    bankAccount.setBankName("11");
    bankAccount.setOpenName("1213");
    bankAccount.setAccount("1231");
    bankAccount.setBranchName("1213");
    bankAccount.setProvince("afa");
    bankAccount.setCity("afasdf");
    bankAccount.setMobile("123132");
    // 数据完整
    try {
      result = RecompenseValidator.validateRecompensePayment(paymentBill);
      assertTrue(true);
    } catch (GeneralException e) {
      fail("数据正常抛出异常");
    }
  }