use of java.text.DecimalFormatSymbols in project j2objc by google.
the class DecimalFormatSymbolsTest method testSerializationCompatibility.
/**
* @tests serialization/deserialization compatibility with RI6.
*/
public void testSerializationCompatibility() throws Exception {
DecimalFormatSymbols symbols = new DecimalFormatSymbols(Locale.US);
symbols.setExponentSeparator("EE");
symbols.setNaN("NaN");
SerializationTest.verifyGolden(this, symbols);
}
use of java.text.DecimalFormatSymbols in project j2objc by google.
the class DecimalFormatSymbolsTest method test_RIHarmony_compatible.
/**
* Assert that Harmony can correct read an instance that was created by
* the Java 1.5 RI. The actual values may differ on Harmony and other JREs,
* so we only assert the values that are known to be in the serialized data.
*/
public void test_RIHarmony_compatible() throws Exception {
DecimalFormatSymbols dfs;
ObjectInputStream i = null;
try {
i = new ObjectInputStream(getClass().getClassLoader().getResourceAsStream("serialization/org/apache/harmony/tests/java/text/DecimalFormatSymbols.ser"));
dfs = (DecimalFormatSymbols) i.readObject();
} finally {
try {
if (i != null) {
i.close();
}
} catch (Exception e) {
}
}
assertDecimalFormatSymbolsRIFrance(dfs);
}
use of java.text.DecimalFormatSymbols in project j2objc by google.
the class DecimalFormatSymbolsTest method test_getInstance.
/**
* @tests java.text.DecimalFormatSymbols#getInstance()
*/
public void test_getInstance() {
assertEquals(new DecimalFormatSymbols(), DecimalFormatSymbols.getInstance());
assertEquals(new DecimalFormatSymbols(Locale.getDefault()), DecimalFormatSymbols.getInstance());
assertNotSame(DecimalFormatSymbols.getInstance(), DecimalFormatSymbols.getInstance());
}
use of java.text.DecimalFormatSymbols in project j2objc by google.
the class DecimalFormatSymbolsTest method setUp.
/**
* Sets up the fixture, for example, open a network connection. This method
* is called before a test is executed.
*/
protected void setUp() {
dfs = new DecimalFormatSymbols();
dfsUS = new DecimalFormatSymbols(new Locale("en", "us"));
}
use of java.text.DecimalFormatSymbols in project j2objc by google.
the class DecimalFormatSymbolsTest method test_setCurrencyLjava_util_Currency.
/**
* @tests java.text.DecimalFormatSymbols#setCurrency(java.util.Currency)
*/
public void test_setCurrencyLjava_util_Currency() {
Locale locale = Locale.CANADA;
DecimalFormatSymbols dfs = ((DecimalFormat) NumberFormat.getCurrencyInstance(locale)).getDecimalFormatSymbols();
try {
dfs.setCurrency(null);
fail("Expected NullPointerException");
} catch (NullPointerException e) {
}
Currency currency = Currency.getInstance("JPY");
dfs.setCurrency(currency);
assertTrue("Returned incorrect currency", currency == dfs.getCurrency());
assertEquals("Returned incorrect currency symbol", currency.getSymbol(locale), dfs.getCurrencySymbol());
assertTrue("Returned incorrect international currency symbol", currency.getCurrencyCode().equals(dfs.getInternationalCurrencySymbol()));
}
Aggregations