Skip to content

Commit d3fbfae

Browse files
committed
Use true as the default value for the failFast parameter
1 parent 9b01e60 commit d3fbfae

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

moneta-core/src/main/java/org/javamoney/moneta/spi/CompoundRateProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ private void addProvider(ExchangeRateProvider prov) {
105105
*/
106106
@Override
107107
public ExchangeRate getExchangeRate(ConversionQuery conversionQuery) {
108-
return getExchangeRate(conversionQuery, false);
108+
return getExchangeRate(conversionQuery, true);
109109
}
110110

111111
public ExchangeRate getExchangeRate(ConversionQuery conversionQuery, boolean failFast) {

moneta-core/src/test/java/org/javamoney/moneta/spi/CompoundRateProviderTest.java

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ public void testGetExchangeRate() {
2323
.set(date)
2424
.build();
2525

26-
ExchangeRateProvider compoundRateProvider = MonetaryConversions.getExchangeRateProvider("ECB", "ECB-HIST90");
27-
assertNotNull(compoundRateProvider.getExchangeRate(conversionQuery));
26+
// Need to cast to CompoundRateProvider to access the getExchangeRate method that takes a boolean parameter
27+
CompoundRateProvider compoundRateProvider = (CompoundRateProvider) MonetaryConversions.getExchangeRateProvider("ECB", "ECB-HIST90");
28+
assertNotNull(compoundRateProvider.getExchangeRate(conversionQuery, false));
2829
}
2930

3031
@Test
@@ -38,8 +39,9 @@ public void testGetExchangeRateAllProvidersFail() {
3839
.set(date)
3940
.build();
4041

41-
ExchangeRateProvider compoundRateProvider = MonetaryConversions.getExchangeRateProvider("ECB", "IMF");
42-
assertThrows(CurrencyConversionException.class, () -> compoundRateProvider.getExchangeRate(conversionQuery));
42+
// Need to cast to CompoundRateProvider to access the getExchangeRate method that takes a boolean parameter
43+
CompoundRateProvider compoundRateProvider = (CompoundRateProvider) MonetaryConversions.getExchangeRateProvider("ECB", "IMF");
44+
assertThrows(CurrencyConversionException.class, () -> compoundRateProvider.getExchangeRate(conversionQuery, false));
4345
}
4446

4547
@Test
@@ -53,9 +55,8 @@ public void testGetExchangeRateFailingFast() {
5355
.set(date)
5456
.build();
5557

56-
// Need to cast to CompoundRateProvider to access the getExchangeRate method that takes a boolean parameter
57-
CompoundRateProvider compoundRateProvider = (CompoundRateProvider) MonetaryConversions.getExchangeRateProvider("ECB", "ECB-HIST90");
58-
assertThrows(CurrencyConversionException.class, () -> compoundRateProvider.getExchangeRate(conversionQuery, true));
58+
ExchangeRateProvider compoundRateProvider = MonetaryConversions.getExchangeRateProvider("ECB", "ECB-HIST90");
59+
assertThrows(CurrencyConversionException.class, () -> compoundRateProvider.getExchangeRate(conversionQuery));
5960
}
6061

6162
private LocalDate lastWeekTuesday() {

0 commit comments

Comments
 (0)