@Test public void test01() { Assertions.assertEquals(converter.convert(BigDecimal.TEN, "EUR", "USD"), new BigDecimal("100")); Assertions.assertTrue(currencyDto.isMethodCalled()); }
public BigDecimal convert(BigDecimal amount, String currencyFrom, String currencyTo) { BigDecimal exchangeRate = currencyDto.getExchangeRate(currencyFrom, currencyTo); return amount.multiply(exchangeRate); }
CurrencyConverter { public BigDecimal convert(BigDecimal amount, String currencyFrom, String currencyTo) { BigDecimal exchangeRate = currencyDto.getExchangeRate(currencyFrom, currencyTo); return amount.multiply(exchangeRate); } }
CurrencyConverter { public BigDecimal convert(BigDecimal amount, String currencyFrom, String currencyTo) { BigDecimal exchangeRate = currencyDto.getExchangeRate(currencyFrom, currencyTo); return amount.multiply(exchangeRate); } CurrencyConverter(CurrencyDto currencyDto); }
CurrencyConverter { public BigDecimal convert(BigDecimal amount, String currencyFrom, String currencyTo) { BigDecimal exchangeRate = currencyDto.getExchangeRate(currencyFrom, currencyTo); return amount.multiply(exchangeRate); } CurrencyConverter(CurrencyDto currencyDto); static CurrencyConverter get(); BigDecimal convert(BigDecimal amount, String currencyFrom, String currencyTo); }
CurrencyConverter { public BigDecimal convert(BigDecimal amount, String currencyFrom, String currencyTo) { BigDecimal exchangeRate = currencyDto.getExchangeRate(currencyFrom, currencyTo); return amount.multiply(exchangeRate); } CurrencyConverter(CurrencyDto currencyDto); static CurrencyConverter get(); BigDecimal convert(BigDecimal amount, String currencyFrom, String currencyTo);  }