private EventPaymentConfig newEventPaymentConfig() { EventPaymentConfig config = new EventPaymentConfig(); config.setDefaultDescription("Settlement Amount"); PaymentComponentTypeLov paymentComponentType = new PaymentComponentTypeLov(); paymentComponentType.setCode("paymentComp1"); config.setPaymentComponentType(paymentComponentType); return config; }
@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()); }