CurrencyTest.java revision ab998708338b76b2d71f42568f46aefa2f4d7908
1/* 2 * Copyright (C) 2010 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17package java.util; 18 19import junit.framework.Test; 20import junit.framework.TestSuite; 21 22public class CurrencyTest extends junit.framework.TestCase { 23 // Regression test to ensure that Currency.getSymbol(Locale) returns the 24 // currency code if ICU doesn't have a localization of the symbol. The 25 // harmony Currency tests don't test this, and their DecimalFormat tests 26 // only test it as a side-effect, and in a way that only detected my 27 // specific mistake of returning null (returning "stinky" would have 28 // passed). 29 public void test_getSymbol_fallback() throws Exception { 30 // This assumes that AED never becomes a currency important enough to 31 // Canada that Canadians give it a localized (to Canada) symbol. 32 assertEquals("AED", Currency.getInstance("AED").getSymbol(Locale.CANADA)); 33 } 34} 35