public void test_convertedTo_noConversionNecessary() { DoubleArray values = DoubleArray.of(1, 2, 3); CurrencyAmountArray test = CurrencyAmountArray.of(GBP, values); FxRate fxRate = FxRate.of(GBP, USD, 1.61); CurrencyAmountArray convertedList = test.convertedTo(GBP, fxRate); assertThat(convertedList).isEqualTo(test); }
public void test_convertedTo() { DoubleArray values = DoubleArray.of(1, 2, 3); CurrencyAmountArray test = CurrencyAmountArray.of(GBP, values); FxRate fxRate = FxRate.of(GBP, USD, 1.61); CurrencyAmountArray convertedList = test.convertedTo(USD, fxRate); DoubleArray expectedValues = DoubleArray.of(1 * 1.61, 2 * 1.61, 3 * 1.61); CurrencyAmountArray expectedList = CurrencyAmountArray.of(USD, expectedValues); assertThat(convertedList).isEqualTo(expectedList); }
public void test_convertedTo_missingFxRate() { DoubleArray values = DoubleArray.of(1, 2, 3); CurrencyAmountArray test = CurrencyAmountArray.of(GBP, values); FxRate fxRate = FxRate.of(EUR, USD, 1.61); assertThrows(() -> test.convertedTo(USD, fxRate), IllegalArgumentException.class); }