From f1db254073577ac656a0bbd59cdc6246502d4bfa Mon Sep 17 00:00:00 2001 From: ghubstan <36207203+ghubstan@users.noreply.github.com> Date: Tue, 27 Oct 2020 13:01:33 -0300 Subject: [PATCH] Make formatSatoshis visible for testing --- cli/src/main/java/bisq/cli/CurrencyFormat.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cli/src/main/java/bisq/cli/CurrencyFormat.java b/cli/src/main/java/bisq/cli/CurrencyFormat.java index 798af169d4..e4d8f89c6c 100644 --- a/cli/src/main/java/bisq/cli/CurrencyFormat.java +++ b/cli/src/main/java/bisq/cli/CurrencyFormat.java @@ -17,6 +17,8 @@ package bisq.cli; +import com.google.common.annotations.VisibleForTesting; + import java.text.DecimalFormat; import java.text.NumberFormat; @@ -27,15 +29,17 @@ import java.util.Locale; import static java.lang.String.format; -class CurrencyFormat { +@VisibleForTesting +public class CurrencyFormat { private static final NumberFormat NUMBER_FORMAT = NumberFormat.getInstance(Locale.US); static final BigDecimal SATOSHI_DIVISOR = new BigDecimal(100000000); static final DecimalFormat BTC_FORMAT = new DecimalFormat("###,##0.00000000"); + @VisibleForTesting @SuppressWarnings("BigDecimalMethodWithoutRoundingCalled") - static String formatSatoshis(long sats) { + public static String formatSatoshis(long sats) { return BTC_FORMAT.format(BigDecimal.valueOf(sats).divide(SATOSHI_DIVISOR)); }