예제 #1
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);
  }
예제 #2
0
 private SearchAdRequest(Builder builder) {
   xl = Builder.a(builder);
   xm = Builder.b(builder);
   xn = Builder.c(builder);
   xo = Builder.d(builder);
   xp = Builder.e(builder);
   xq = Builder.f(builder);
   xr = Builder.g(builder);
   xs = Builder.h(builder);
   xt = Builder.i(builder);
   xu = Builder.j(builder);
   xv = Builder.k(builder);
   xw = Builder.l(builder);
   xx = Builder.m(builder);
   xy = Builder.n(builder);
   ld = new bg(Builder.o(builder), this);
 }
예제 #3
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());
  }
예제 #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));
 }