staticfinal CurrencyNameProvider cnp = new CurrencyNameProviderImpl();
publicstaticvoid main(String[] args) throws Exception { // test for NullPointerException (currencyCode) try {
cnp.getDisplayName(null, Locale.US);
throwException("NPE was not thrown with null currencyCode");
} catch (NullPointerException npe) {}
// test for NullPointerException (locale) try {
cnp.getDisplayName("USD", null);
throwException("NPE was not thrown with null locale");
} catch (NullPointerException npe) {}
// test for IllegalArgumentException (illegal currencyCode) try {
cnp.getDisplayName("INVALID", Locale.US);
throwException("IllegalArgumentException was not thrown with invalid currency code");
} catch (IllegalArgumentException iae) {} try {
cnp.getDisplayName("inv", Locale.US);
throwException("IllegalArgumentException was not thrown with invalid currency code");
} catch (IllegalArgumentException iae) {}
// test for IllegalArgumentException (non-supported locale) try {
cnp.getDisplayName("USD", Locale.JAPAN);
throwException("IllegalArgumentException was not thrown with non-supported locale");
} catch (IllegalArgumentException iae) {}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.