예제 #1
0
  /** The nettAmout must default to the grossAmount. */
  @Test
  public void nettAmountMustBeEqualToGrossAmountWhenNoWithholding() {
    PaymentCalc calc = new PaymentCalc();
    assertThat(calc.getNettAmount()).isNull();

    calc.setGrossAmount(new BigDecimal(100.55));

    assertThat(calc.getNettAmount()).isEqualTo(new BigDecimal(100.55));
  }
예제 #2
0
  @Test
  public void getComponentValueByDescription() {
    EventPaymentConfig config = newEventPaymentConfig();

    EventPaymentConfig.findByDescription("Settlement Amount");
    AnnotationDrivenStaticEntityMockingControl.expectReturn(config);
    AnnotationDrivenStaticEntityMockingControl.playback();

    PaymentCalc calc =
        Builder.n()
            .fees(new BigDecimal(100d))
            .interest(new BigDecimal(50d))
            .other1(new BigDecimal(100d))
            .other2(new BigDecimal(75))
            .settlementAmount(new BigDecimal(175d))
            .get();

    assertThat(calc.getComponentValueByDescription("Settlement Amount"))
        .isEqualTo(calc.getPaymentComp1());
  }
예제 #3
0
  /** Test the {@link PaymentCalc#multiply(java.math.BigDecimal)} method. */
  @Test
  public void multiply() {
    PaymentCalc calc =
        Builder.n()
            .grossAmount(new BigDecimal(500d))
            .fees(new BigDecimal(100.25d))
            .interest(new BigDecimal(50d))
            .other1(new BigDecimal(100d))
            .other2(new BigDecimal(75))
            .settlementAmount(new BigDecimal(175d))
            .nettAmount(new BigDecimal(400d))
            .get();

    PaymentCalc actual = calc.clone();
    actual.multiply(new BigDecimal(0.50d));

    PaymentCalc expected =
        Builder.n()
            .grossAmount(new BigDecimal(250d))
            .fees(new BigDecimal("50.12"))
            .interest(new BigDecimal(25d))
            .other1(new BigDecimal(50d))
            .other2(new BigDecimal(37.5))
            .settlementAmount(new BigDecimal(87.5d))
            .nettAmount(new BigDecimal(200d))
            .get();
    // This is just to sen the scale and rounding.
    expected.multiply(new BigDecimal(1));

    assertThat(actual).isEqualTo(expected);
  }
예제 #4
0
 /**
  * Test the {@link PaymentCalc#percentageOfNettAmount(java.math.BigDecimal)} method.
  *
  * <p>The amount is a double.
  *
  * @see https://bostonfinancial.atlassian.net/browse/PIA-203
  */
 @Test
 public void percentageOfNettAmountOfTypeDouble() {
   PaymentCalc calc = Builder.n().nettAmount(new BigDecimal(100.75)).get();
   assertThat(calc.percentageOfNettAmount(new BigDecimal(10)))
       .isEqualTo(new BigDecimal(9.92).setScale(2, BigDecimal.ROUND_HALF_UP));
 }
예제 #5
0
 public Builder other2(BigDecimal param) {
   ret.setPaymentComp5(param);
   return this;
 }
예제 #6
0
 public Builder fees(BigDecimal param) {
   ret.setPaymentComp3(param);
   return this;
 }
예제 #7
0
 public Builder interest(BigDecimal param) {
   ret.setPaymentComp2(param);
   return this;
 }
예제 #8
0
 public Builder settlementAmount(BigDecimal param) {
   ret.setPaymentComp1(param);
   return this;
 }
예제 #9
0
 public Builder nettAmount(BigDecimal param) {
   ret.setNettAmount(param);
   return this;
 }
예제 #10
0
 public Builder grossAmount(BigDecimal param) {
   ret.setGrossAmount(param);
   return this;
 }