mirror of
https://github.com/Qortal/altcoinj.git
synced 2025-01-31 15:22:16 +00:00
Fix or comment out a few Java 7isms.
This commit is contained in:
parent
e2b802235d
commit
308de4edc1
@ -520,7 +520,7 @@ public abstract class BtcFormat extends Format {
|
|||||||
* units indicated by the given scale differs from that same value denominated in satoshis */
|
* units indicated by the given scale differs from that same value denominated in satoshis */
|
||||||
private static int offSatoshis(int scale) { return Coin.SMALLEST_UNIT_EXPONENT - scale; }
|
private static int offSatoshis(int scale) { return Coin.SMALLEST_UNIT_EXPONENT - scale; }
|
||||||
|
|
||||||
private static Locale defaultLocale() { return Locale.getDefault(Locale.Category.FORMAT); }
|
private static Locale defaultLocale() { return Locale.getDefault(); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>This class constructs new instances of {@link BtcFormat}, allowing for the
|
* <p>This class constructs new instances of {@link BtcFormat}, allowing for the
|
||||||
|
@ -16,48 +16,28 @@
|
|||||||
|
|
||||||
package com.google.bitcoin.utils;
|
package com.google.bitcoin.utils;
|
||||||
|
|
||||||
|
import com.google.bitcoin.core.Coin;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.Rule;
|
import org.junit.runner.RunWith;
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertFalse;
|
|
||||||
import static org.junit.Assert.assertNotEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
import static org.junit.Assert.assertTrue;
|
|
||||||
import static org.junit.Assert.fail;
|
|
||||||
import org.junit.rules.ExpectedException;
|
|
||||||
import org.junit.runners.Parameterized;
|
import org.junit.runners.Parameterized;
|
||||||
import org.junit.runners.Parameterized.Parameters;
|
import org.junit.runners.Parameterized.Parameters;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.AttributedCharacterIterator;
|
import java.text.*;
|
||||||
import java.text.AttributedCharacterIterator.Attribute;
|
import java.text.AttributedCharacterIterator.Attribute;
|
||||||
import java.text.CharacterIterator;
|
|
||||||
import java.text.DecimalFormat;
|
|
||||||
import java.text.DecimalFormatSymbols;
|
|
||||||
import java.text.FieldPosition;
|
|
||||||
import java.text.NumberFormat;
|
|
||||||
import java.text.ParseException;
|
|
||||||
import static java.text.NumberFormat.Field.DECIMAL_SEPARATOR;
|
|
||||||
|
|
||||||
import java.util.Locale;
|
|
||||||
import static java.util.Locale.*;
|
|
||||||
import java.util.Currency;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Locale;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static com.google.common.base.Strings.repeat;
|
import static com.google.bitcoin.core.Coin.*;
|
||||||
|
|
||||||
import com.google.bitcoin.core.Coin;
|
|
||||||
import static com.google.bitcoin.core.NetworkParameters.MAX_MONEY;
|
import static com.google.bitcoin.core.NetworkParameters.MAX_MONEY;
|
||||||
import static com.google.bitcoin.core.Coin.parseCoin;
|
import static com.google.bitcoin.utils.BtcAutoFormat.Style.CODE;
|
||||||
import static com.google.bitcoin.core.Coin.valueOf;
|
import static com.google.bitcoin.utils.BtcAutoFormat.Style.SYMBOL;
|
||||||
import static com.google.bitcoin.core.Coin.COIN;
|
import static com.google.bitcoin.utils.BtcFixedFormat.REPEATING_DOUBLETS;
|
||||||
import static com.google.bitcoin.core.Coin.SMALLEST_UNIT_EXPONENT;
|
import static com.google.bitcoin.utils.BtcFixedFormat.REPEATING_TRIPLETS;
|
||||||
import static com.google.bitcoin.core.Coin.SATOSHI;
|
import static java.text.NumberFormat.Field.DECIMAL_SEPARATOR;
|
||||||
import static com.google.bitcoin.core.Coin.ZERO;
|
import static java.util.Locale.*;
|
||||||
import static com.google.bitcoin.utils.BtcFixedFormat.*;
|
import static org.junit.Assert.*;
|
||||||
import static com.google.bitcoin.utils.BtcAutoFormat.Style.*;
|
|
||||||
|
|
||||||
@RunWith(Parameterized.class)
|
@RunWith(Parameterized.class)
|
||||||
public class BtcFormatTest {
|
public class BtcFormatTest {
|
||||||
@ -1186,7 +1166,7 @@ public class BtcFormatTest {
|
|||||||
assertEquals("฿-1.00", BtcFormat.getSymbolInstance(JAPAN).format(COIN.multiply(-1)));
|
assertEquals("฿-1.00", BtcFormat.getSymbolInstance(JAPAN).format(COIN.multiply(-1)));
|
||||||
assertEquals("(BTC 1.00)", BtcFormat.getInstance(US).format(COIN.multiply(-1)));
|
assertEquals("(BTC 1.00)", BtcFormat.getInstance(US).format(COIN.multiply(-1)));
|
||||||
assertEquals("(฿1.00)", BtcFormat.getSymbolInstance(US).format(COIN.multiply(-1)));
|
assertEquals("(฿1.00)", BtcFormat.getSymbolInstance(US).format(COIN.multiply(-1)));
|
||||||
assertEquals("BTC -१.००", BtcFormat.getInstance(Locale.forLanguageTag("hi-IN")).format(COIN.multiply(-1)));
|
// assertEquals("BTC -१.००", BtcFormat.getInstance(Locale.forLanguageTag("hi-IN")).format(COIN.multiply(-1)));
|
||||||
assertEquals("BTC -๑.๐๐", BtcFormat.getInstance(new Locale("th","TH","TH")).format(COIN.multiply(-1)));
|
assertEquals("BTC -๑.๐๐", BtcFormat.getInstance(new Locale("th","TH","TH")).format(COIN.multiply(-1)));
|
||||||
assertEquals("Ƀ-๑.๐๐", BtcFormat.getSymbolInstance(new Locale("th","TH","TH")).format(COIN.multiply(-1)));
|
assertEquals("Ƀ-๑.๐๐", BtcFormat.getSymbolInstance(new Locale("th","TH","TH")).format(COIN.multiply(-1)));
|
||||||
}
|
}
|
||||||
@ -1296,7 +1276,7 @@ public class BtcFormatTest {
|
|||||||
assertEquals("BTC #,##0.00;(BTC #,##0.00)", BtcFormat.getCodeInstance(Locale.US).pattern());
|
assertEquals("BTC #,##0.00;(BTC #,##0.00)", BtcFormat.getCodeInstance(Locale.US).pattern());
|
||||||
assertEquals("฿#,##0.00;(฿#,##0.00)", BtcFormat.getSymbolInstance(Locale.US).pattern());
|
assertEquals("฿#,##0.00;(฿#,##0.00)", BtcFormat.getSymbolInstance(Locale.US).pattern());
|
||||||
assertEquals('0', BtcFormat.getInstance(Locale.US).symbols().getZeroDigit());
|
assertEquals('0', BtcFormat.getInstance(Locale.US).symbols().getZeroDigit());
|
||||||
assertEquals('०', BtcFormat.getInstance(Locale.forLanguageTag("hi-IN")).symbols().getZeroDigit());
|
// assertEquals('०', BtcFormat.getInstance(Locale.forLanguageTag("hi-IN")).symbols().getZeroDigit());
|
||||||
// TODO will this next line work with other JREs?
|
// TODO will this next line work with other JREs?
|
||||||
assertEquals('๐', BtcFormat.getInstance(new Locale("th","TH","TH")).symbols().getZeroDigit());
|
assertEquals('๐', BtcFormat.getInstance(new Locale("th","TH","TH")).symbols().getZeroDigit());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user