1 // Tags: JDK1.4 |
|
2 |
|
3 // Copyright (C) 2004 Andrew John Hughes <gnu_andrew@member.fsf.org> |
|
4 |
|
5 // This file is part of Mauve. |
|
6 |
|
7 // Mauve is free software; you can redistribute it and/or modify |
|
8 // it under the terms of the GNU General Public License as published by |
|
9 // the Free Software Foundation; either version 2, or (at your option) |
|
10 // any later version. |
|
11 |
|
12 // Mauve is distributed in the hope that it will be useful, |
|
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
15 // GNU General Public License for more details. |
|
16 |
|
17 // You should have received a copy of the GNU General Public License |
|
18 // along with Mauve; see the file COPYING. If not, write to |
|
19 // the Free Software Foundation, 59 Temple Place - Suite 330, |
|
20 // Boston, MA 02111-1307, USA. |
|
21 |
|
22 package gnu.testlet.java.util.Currency; |
|
23 |
|
24 import gnu.testlet.Testlet; |
|
25 import gnu.testlet.TestHarness; |
|
26 import java.util.Currency; |
|
27 import java.util.Locale; |
|
28 |
|
29 /** |
|
30 * Class to test the Taiwanese currency. |
|
31 * |
|
32 * @author Andrew John Hughes <gnu_andrew@member.fsf.org> |
|
33 */ |
|
34 public class Taiwan implements Testlet |
|
35 { |
|
36 |
|
37 private static final Locale TEST_LOCALE = Locale.TAIWAN; |
|
38 private static final String ISO4217_CODE = "TWD"; |
|
39 private static final String CURRENCY_SYMBOL = "NT$"; |
|
40 private static final int FRACTION_DIGITS = 0; |
|
41 |
|
42 public void test(TestHarness harness) |
|
43 { |
|
44 Currency currency; |
|
45 |
|
46 /* Set default Locale for the JVM */ |
|
47 Locale.setDefault(TEST_LOCALE); |
|
48 /* Get an instance of the currency */ |
|
49 currency = Currency.getInstance(TEST_LOCALE); |
|
50 /* Check for the correct currency code */ |
|
51 harness.check(currency.getCurrencyCode(),ISO4217_CODE, "ISO 4217 currency code retrieval check (" + |
|
52 currency.getCurrencyCode() + ")."); |
|
53 /* Check for the correct currency symbol */ |
|
54 harness.check(currency.getSymbol(), CURRENCY_SYMBOL, "Currency symbol retrieval check (" + |
|
55 currency.getSymbol() + ")."); |
|
56 /* Check for the correct fraction digits */ |
|
57 harness.check(currency.getDefaultFractionDigits(), FRACTION_DIGITS, "Currency fraction digits retrieval check (" + |
|
58 currency.getDefaultFractionDigits() + ")."); |
|
59 /* Check for the correct currency code from toString()*/ |
|
60 harness.check(currency.toString(),ISO4217_CODE, "ISO 4217 currency code retrieval check (" + currency.toString() + ")."); |
|
61 } |
|
62 |
|
63 } |
|