### Question:
FxRateImpl implements FxRate { @Override public CurrencyAmount getReceiptAmountForSelling(final CurrencyAmount amountToSell) { boolean inverse = amountToSell.getCurrency().equals(currencyPair.getCcy2()); final String targetCcy = inverse ? currencyPair.getCcy1() : currencyPair.getCcy2(); int decPlace = DEC_PLACE_FOR_MONEY; try { decPlace = Currency.getInstance(targetCcy).getDefaultFractionDigits(); } catch (IllegalArgumentException iae) { } return inverse ? new Cash(targetCcy, setScale(BigDecimalUtil.divide(PRECISION_FOR_INVERSE, amountToSell.getAmount(), ask, BigDecimal.ROUND_HALF_UP), decPlace)) : new Cash(targetCcy, setScale(amountToSell.getAmount().multiply(bid), decPlace)) ; } FxRateImpl(final CurrencyPair currencyPair, final String crossCcy, final boolean marketConvention, final BigDecimal bid,
            final BigDecimal ask, CurrencyProvider currencyProvider); @Override String getDescription(); @Override FxRate createInverse(); @Override FxRate createInverse(final int precision); @Override BigDecimal getBid(); @Override BigDecimal getAsk(); @Override CurrencyPair getCurrencyPair(); @Override Optional<String> getCrossCcy(); @Override boolean isMarketConvention(); @Override BigDecimal getMid(); @Override BigDecimal getBidInMarketConvention(); @Override BigDecimal getMidInMarketConvention(); @Override BigDecimal getAskInMarketConvention(); @Override String toString(); @Override CurrencyAmount convertAmountUsingMid(final CurrencyAmount originalAmount); @Override CurrencyAmount convertAmountUsingBidOrAsk(final CurrencyAmount originalAmount); @Override CurrencyAmount getPaymentAmountForBuying(final CurrencyAmount amountToBuy); @Override CurrencyAmount getReceiptAmountForSelling(final CurrencyAmount amountToSell);  }### Answer:
@Test public void testGetReceipAmountForSelling() { FxRateImpl f = new FxRateImpl(CurrencyPair.of("EUR", "USD"), null, true, BigDecimalUtil.bd("1.6"), BigDecimalUtil.bd("1.61"), new JdkCurrencyProvider()); final CurrencyAmount receipt = f.getReceiptAmountForSelling(Cash.of("USD", BigDecimalUtil.bd("1000"))); assertThat(receipt.getCurrency()).isEqualTo("EUR"); assertThat(receipt.getAmount()).isEqualByComparingTo("621.12"); final CurrencyAmount receipt2 = f.getReceiptAmountForSelling(Cash.of("EUR", BigDecimalUtil.bd("1000"))); assertThat(receipt2.getCurrency()).isEqualTo("USD"); assertThat(receipt2.getAmount()).isEqualByComparingTo("1600"); }