@Test public void testFormatAlertMessage_MultiBit_uXBT_de_DE() throws Exception { bitcoinConfiguration.setDecimalSeparator(","); bitcoinConfiguration.setGroupingSeparator("."); bitcoinConfiguration.setBitcoinSymbol(BitcoinSymbol.UXBT.name()); final BitcoinURI bitcoinURI = new BitcoinURI("bitcoin:1AhN6rPdrMuKBGFDKR1k9A8SCLYaNgXhty?amount=0.01&label=Please%20donate%20to%20multibit.org"); assertThat(Formats.formatAlertMessage(bitcoinURI).get()).isEqualTo("Payment \"Please donate to multibit.org\" (1AhN6rPdrMuKBGFDKR1k9A8SCLYaNgXhty) for \"\u00b5XBT 10.000" + ",00\". Continue ?"); }
public static String formatAlertMessage(TransactionSeenEvent event) { final Coin amount = event.getAmount(); final Coin modulusAmount; if (amount.compareTo(Coin.ZERO) >= 0) { modulusAmount = amount; } else { modulusAmount = amount.negate(); } final String messageAmount = Formats.formatCoinAsSymbolicText( modulusAmount, Configurations.currentConfiguration.getLanguage(), Configurations.currentConfiguration.getBitcoin() ); if (amount.compareTo(Coin.ZERO) >= 0) { return Languages.safeText(MessageKey.PAYMENT_RECEIVED_ALERT, messageAmount); } else { return Languages.safeText(MessageKey.PAYMENT_SENT_ALERT, messageAmount); } }
Formats { public static String formatAlertMessage(TransactionSeenEvent event) { final Coin amount = event.getAmount(); final Coin modulusAmount; if (amount.compareTo(Coin.ZERO) >= 0) { modulusAmount = amount; } else { modulusAmount = amount.negate(); } final String messageAmount = Formats.formatCoinAsSymbolicText( modulusAmount, Configurations.currentConfiguration.getLanguage(), Configurations.currentConfiguration.getBitcoin() ); if (amount.compareTo(Coin.ZERO) >= 0) { return Languages.safeText(MessageKey.PAYMENT_RECEIVED_ALERT, messageAmount); } else { return Languages.safeText(MessageKey.PAYMENT_SENT_ALERT, messageAmount); } } }
Formats { public static String formatAlertMessage(TransactionSeenEvent event) { final Coin amount = event.getAmount(); final Coin modulusAmount; if (amount.compareTo(Coin.ZERO) >= 0) { modulusAmount = amount; } else { modulusAmount = amount.negate(); } final String messageAmount = Formats.formatCoinAsSymbolicText( modulusAmount, Configurations.currentConfiguration.getLanguage(), Configurations.currentConfiguration.getBitcoin() ); if (amount.compareTo(Coin.ZERO) >= 0) { return Languages.safeText(MessageKey.PAYMENT_RECEIVED_ALERT, messageAmount); } else { return Languages.safeText(MessageKey.PAYMENT_SENT_ALERT, messageAmount); } }  }
Formats { public static String formatAlertMessage(TransactionSeenEvent event) { final Coin amount = event.getAmount(); final Coin modulusAmount; if (amount.compareTo(Coin.ZERO) >= 0) { modulusAmount = amount; } else { modulusAmount = amount.negate(); } final String messageAmount = Formats.formatCoinAsSymbolicText( modulusAmount, Configurations.currentConfiguration.getLanguage(), Configurations.currentConfiguration.getBitcoin() ); if (amount.compareTo(Coin.ZERO) >= 0) { return Languages.safeText(MessageKey.PAYMENT_RECEIVED_ALERT, messageAmount); } else { return Languages.safeText(MessageKey.PAYMENT_SENT_ALERT, messageAmount); } }  static String[] formatCoinAsSymbolic(
    Coin coin,
    LanguageConfiguration languageConfiguration,
    BitcoinConfiguration bitcoinConfiguration
  ); static String[] formatCoinAsSymbolic(
    Coin coin,
    LanguageConfiguration languageConfiguration,
    BitcoinConfiguration bitcoinConfiguration,
    boolean showNegative
  ); static String formatCoinAsSymbolicText(
    Coin coin,
    LanguageConfiguration languageConfiguration,
    BitcoinConfiguration bitcoinConfiguration
  ); static String formatCoinAmount(Coin coin, LanguageConfiguration languageConfiguration, BitcoinConfiguration bitcoinConfiguration); static String formatLocalAmount(BigDecimal amount, Locale locale, BitcoinConfiguration bitcoinConfiguration, boolean showNegative); static String formatExchangeRate(
    Optional<String> exchangeRate,
    LanguageConfiguration languageConfiguration,
    BitcoinConfiguration bitcoinConfiguration
  ); static String formatAlertMessage(TransactionSeenEvent event); static Optional<String> formatAlertMessage(BitcoinURI bitcoinURI); static Optional<String> formatAlertMessage(PaymentSessionSummary paymentSessionSummary); }
Formats { public static String formatAlertMessage(TransactionSeenEvent event) { final Coin amount = event.getAmount(); final Coin modulusAmount; if (amount.compareTo(Coin.ZERO) >= 0) { modulusAmount = amount; } else { modulusAmount = amount.negate(); } final String messageAmount = Formats.formatCoinAsSymbolicText( modulusAmount, Configurations.currentConfiguration.getLanguage(), Configurations.currentConfiguration.getBitcoin() ); if (amount.compareTo(Coin.ZERO) >= 0) { return Languages.safeText(MessageKey.PAYMENT_RECEIVED_ALERT, messageAmount); } else { return Languages.safeText(MessageKey.PAYMENT_SENT_ALERT, messageAmount); } }  static String[] formatCoinAsSymbolic(
    Coin coin,
    LanguageConfiguration languageConfiguration,
    BitcoinConfiguration bitcoinConfiguration
  ); static String[] formatCoinAsSymbolic(
    Coin coin,
    LanguageConfiguration languageConfiguration,
    BitcoinConfiguration bitcoinConfiguration,
    boolean showNegative
  ); static String formatCoinAsSymbolicText(
    Coin coin,
    LanguageConfiguration languageConfiguration,
    BitcoinConfiguration bitcoinConfiguration
  ); static String formatCoinAmount(Coin coin, LanguageConfiguration languageConfiguration, BitcoinConfiguration bitcoinConfiguration); static String formatLocalAmount(BigDecimal amount, Locale locale, BitcoinConfiguration bitcoinConfiguration, boolean showNegative); static String formatExchangeRate(
    Optional<String> exchangeRate,
    LanguageConfiguration languageConfiguration,
    BitcoinConfiguration bitcoinConfiguration
  ); static String formatAlertMessage(TransactionSeenEvent event); static Optional<String> formatAlertMessage(BitcoinURI bitcoinURI); static Optional<String> formatAlertMessage(PaymentSessionSummary paymentSessionSummary); static final int EXCHANGE_RATE_DECIMAL_PLACES_OFFSET; }