AmountService implements AmountRepository { @NonNull @Override public BigDecimal getItemsPlusCharges(@NonNull final String paymentTypeId) { return getItemsAmount() .add(chargeRepository.getChargeAmount(paymentTypeId)); } AmountService(@NonNull final PaymentSettingRepository paymentSetting,
        @NonNull final ChargeRepository chargeRepository,
        @NonNull final DiscountRepository discountRepository); @Override @NonNull BigDecimal getAmountToPay(@NonNull final String paymentTypeId, @Nullable final PayerCost payerCost); @NonNull @Override BigDecimal getAmountToPay(@NonNull final String paymentTypeId,
        @NonNull final DiscountConfigurationModel discountModel); @Override @NonNull BigDecimal getItemsAmount(); @NonNull @Override BigDecimal getItemsPlusCharges(@NonNull final String paymentTypeId); @NonNull @Override BigDecimal getAppliedCharges(@NonNull final String paymentTypeId, @Nullable final PayerCost payerCost); @NonNull @Override BigDecimal getAmountWithoutDiscount(@NonNull final String paymentTypeId, @Nullable final PayerCost payerCost);  }
@Test public void whenHasChargesAmountThenGetItemsAmountPlusCharges() { when(chargeRepository.getChargeAmount(PaymentTypes.CREDIT_CARD)).thenReturn(BigDecimal.ONE); assertEquals(BigDecimal.TEN.add(BigDecimal.ONE), amountService.getItemsPlusCharges(PaymentTypes.CREDIT_CARD)); }
@Test public void whenHasNoChargesAmountThenGetItemsAmount() { when(chargeRepository.getChargeAmount(PaymentTypes.CREDIT_CARD)).thenReturn(BigDecimal.ZERO); assertEquals(BigDecimal.TEN, amountService.getItemsPlusCharges(PaymentTypes.CREDIT_CARD)); }