use of java.text.ChoiceFormat in project j2objc by google.
the class NumberFormatTest method test_setRoundingMode_NullRoundingMode.
public void test_setRoundingMode_NullRoundingMode() {
try {
// Create a subclass ChoiceFormat which doesn't support
// RoundingMode
ChoiceFormat choiceFormat = new ChoiceFormat("0#Less than one|1#one|1<Between one and two|2<Greater than two");
((NumberFormat) choiceFormat).setRoundingMode(null);
// Follow the behavior of RI
fail("UnsupportedOperationException expected");
} catch (UnsupportedOperationException e) {
// expected
}
}
use of java.text.ChoiceFormat in project j2objc by google.
the class NumberFormatTest method test_getCurrency.
/**
* @tests java.text.NumberFormat#getCurrency()
*/
public void test_getCurrency() {
// Test for method java.util.Currency getCurrency()
// a subclass that supports currency formatting
Currency currH = Currency.getInstance("HUF");
NumberFormat format = NumberFormat.getInstance(new Locale("hu", "HU"));
assertSame("Returned incorrect currency", currH, format.getCurrency());
// a subclass that doesn't support currency formatting
ChoiceFormat cformat = new ChoiceFormat("0#Less than one|1#one|1<Between one and two|2<Greater than two");
try {
((NumberFormat) cformat).getCurrency();
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException e) {
}
}
use of java.text.ChoiceFormat in project robovm by robovm.
the class OldNumberFormatTest method test_setCurrencyLjava_util_Currency.
public void test_setCurrencyLjava_util_Currency() {
// Test for method void setCurrency(java.util.Currency)
// a subclass that supports currency formatting
Currency currA = Currency.getInstance("ARS");
NumberFormat format = NumberFormat.getInstance(new Locale("hu", "HU"));
format.setCurrency(currA);
assertSame("Returned incorrect currency", currA, format.getCurrency());
// a subclass that doesn't support currency formatting
ChoiceFormat cformat = new ChoiceFormat("0#Less than one|1#one|1<Between one and two|2<Greater than two");
try {
((NumberFormat) cformat).setCurrency(currA);
fail("Expected UnsupportedOperationException");
} catch (UnsupportedOperationException e) {
}
try {
NumberFormat.getInstance().setCurrency(null);
fail("NullPointerException was thrown.");
} catch (NullPointerException npe) {
//expected
}
try {
NumberFormat.getIntegerInstance().setCurrency(null);
fail("NullPointerException was thrown.");
} catch (NullPointerException npe) {
//expected
}
}
Aggregations