Skip to content

Commit

Permalink
#315 Fix misspelling: replace Fond with Fund.
Browse files Browse the repository at this point in the history
  • Loading branch information
atsticks committed Sep 12, 2019
1 parent d8eb163 commit 7926947
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ public enum ExchangeRateType implements ExchangeRateProviderSupplier {
*/
ECB("ECB", "Exchange rate to the European Central Bank."),
/**
* Exchange rate to the International Monetary Fond. Uses the
* Exchange rate to the International Monetary Fund. Uses the
* {@code IMFRateProvider} implementation.
*/
IMF("IMF", "Exchange rate to the International Monetary Fond."),
IMF("IMF", "Exchange rate to the International Monetary Fund."),
/**
* Exchange rate to the International Monetary Fond from historic. Uses the
* Exchange rate to the International Monetary Fund from historic. Uses the
* {@code IMFHistoricRateProvider} implementation.
*/
IMF_HIST("IMF-HIST", "Exchange rate to the International Monetary Fond that retrieve historical information on lazy way."),
IMF_HIST("IMF-HIST", "Exchange rate to the International Monetary Fund that retrieve historical information on lazy way."),
/**
* Exchange rate to European Central Bank (last 90 days). Uses the
* {@code ECBHistoric90RateProvider} implementation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ public void shouldSetTimeInLocalDateTime() {
LocalDate localDate = YearMonth.of(2014, Month.JANUARY).atDay(9);

ConversionQuery conversionQuery = ConversionQueryBuilder.of()
.setTermCurrency(EURO).set(localDate).build();
.setTermCurrency(EURO).set(localDate).build();
CurrencyConversion currencyConversion = provider
.getCurrencyConversion(conversionQuery);
assertNotNull(currencyConversion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public class IMFHistoricRateProvider extends IMFAbstractRateProvider {
private static final String DATA_ID = IMFHistoricRateProvider.class.getSimpleName();

private static final ProviderContext CONTEXT = ProviderContextBuilder.of("IMF-HIST", RateType.HISTORIC)
.set("providerDescription", "Historic International Monetary Fond")
.set("providerDescription", "Historic International Monetary Fund")
.set("days", 0)
.set("User-Agent", "Chrome/51.0.2704.103")
.build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class IMFRateProvider extends IMFAbstractRateProvider {
* The {@link ConversionContext} of this provider.
*/
private static final ProviderContext CONTEXT = ProviderContextBuilder.of("IMF", RateType.DEFERRED)
.set("providerDescription", "International Monetary Fond")
.set("providerDescription", "International Monetary Fund")
.set("days", 1)
.set("User-Agent", "Chrome/51.0.2704.103")
.build();
Expand Down
8 changes: 7 additions & 1 deletion moneta-core/src/main/java/org/javamoney/moneta/Money.java
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,13 @@ public boolean equals(Object obj) {
*/
@Override
public String toString() {
return getCurrency().getCurrencyCode() + ' ' + number.toPlainString();
try {
MonetaryAmount amount = Monetary.getDefaultRounding().apply(this);
return getCurrency().getCurrencyCode() + ' ' + amount.getNumber().numberValue(BigDecimal.class)
.toPlainString();
}catch(Exception e) {
return getCurrency().getCurrencyCode() + ' ' + number.toPlainString();
}
}

/*
Expand Down

0 comments on commit 7926947

Please # to comment.