001: /*
002: *******************************************************************************
003: * Copyright (C) 2006, International Business Machines Corporation and *
004: * others. All Rights Reserved. *
005: *******************************************************************************
006: */
007:
008: package com.ibm.icu.tests;
009:
010: import java.util.Locale;
011:
012: import com.ibm.icu.text.DecimalFormatSymbols;
013: import com.ibm.icu.util.ULocale;
014:
015: public class DecimalFormatSymbolsTest extends ICUTestCase {
016:
017: /*
018: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.hashCode()'
019: */
020: public void testHashCode() {
021: DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US);
022: DecimalFormatSymbols dfs2 = new DecimalFormatSymbols(ULocale.US);
023: DecimalFormatSymbols dfsn = new DecimalFormatSymbols(
024: Locale.FRANCE);
025: testEHCS(dfs, dfs2, dfsn);
026: }
027:
028: /*
029: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.DecimalFormatSymbols(DecimalFormatSymbols)'
030: */
031: public void testDecimalFormatSymbolsDecimalFormatSymbols() {
032: // implicitly tested everywhere
033: }
034:
035: /*
036: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.DecimalFormatSymbols()'
037: */
038: public void testDecimalFormatSymbols() {
039: DecimalFormatSymbols dfs = new DecimalFormatSymbols();
040: assertTrue(-1 != dfs.getDecimalSeparator());
041: }
042:
043: /*
044: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.DecimalFormatSymbols(Locale)'
045: */
046: public void testDecimalFormatSymbolsLocale() {
047: DecimalFormatSymbols dfs = new DecimalFormatSymbols(Locale.US);
048: assertTrue(-1 != dfs.getDecimalSeparator());
049: }
050:
051: /*
052: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.DecimalFormatSymbols(ULocale)'
053: */
054: public void testDecimalFormatSymbolsULocale() {
055: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
056: assertTrue(-1 != dfs.getDecimalSeparator());
057: }
058:
059: /*
060: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getZeroDigit()'
061: */
062: public void testGetZeroDigit() {
063: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
064: assertEquals('0', dfs.getZeroDigit());
065: }
066:
067: /*
068: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setZeroDigit(char)'
069: */
070: public void testSetZeroDigit() {
071: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
072: char value = dfs.getZeroDigit();
073: char value1 = (char) (value + 1);
074: dfs.setZeroDigit(value1);
075: char result = dfs.getZeroDigit();
076: assertNotEqual(value, result);
077: assertEquals(value1, result);
078: }
079:
080: /*
081: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getGroupingSeparator()'
082: */
083: public void testGetGroupingSeparator() {
084: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
085: assertEquals(',', dfs.getGroupingSeparator());
086: }
087:
088: /*
089: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setGroupingSeparator(char)'
090: */
091: public void testSetGroupingSeparator() {
092: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
093: char value = dfs.getGroupingSeparator();
094: char value1 = (char) (value + 1);
095: dfs.setGroupingSeparator(value1);
096: char result = dfs.getGroupingSeparator();
097: assertNotEqual(value, result);
098: assertEquals(value1, result);
099: }
100:
101: /*
102: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getDecimalSeparator()'
103: */
104: public void testGetDecimalSeparator() {
105: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
106: assertEquals('.', dfs.getDecimalSeparator());
107: }
108:
109: /*
110: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setDecimalSeparator(char)'
111: */
112: public void testSetDecimalSeparator() {
113: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
114: char value = dfs.getDecimalSeparator();
115: char value1 = (char) (value + 1);
116: dfs.setDecimalSeparator(value1);
117: char result = dfs.getDecimalSeparator();
118: assertNotEqual(value, result);
119: assertEquals(value1, result);
120: }
121:
122: /*
123: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getPerMill()'
124: */
125: public void testGetPerMill() {
126: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
127: assertEquals('\u2030', dfs.getPerMill());
128: }
129:
130: /*
131: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setPerMill(char)'
132: */
133: public void testSetPerMill() {
134: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
135: char value = dfs.getPerMill();
136: char value1 = (char) (value + 1);
137: dfs.setPerMill(value1);
138: char result = dfs.getPerMill();
139: assertNotEqual(value, result);
140: assertEquals(value1, result);
141: }
142:
143: /*
144: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getPercent()'
145: */
146: public void testGetPercent() {
147: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
148: assertEquals('%', dfs.getPercent());
149: }
150:
151: /*
152: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setPercent(char)'
153: */
154: public void testSetPercent() {
155: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
156: char value = dfs.getPercent();
157: char value1 = (char) (value + 1);
158: dfs.setPercent(value1);
159: char result = dfs.getPercent();
160: assertNotEqual(value, result);
161: assertEquals(value1, result);
162: }
163:
164: /*
165: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getDigit()'
166: */
167: public void testGetDigit() {
168: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
169: assertEquals('#', dfs.getDigit());
170: }
171:
172: /*
173: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setDigit(char)'
174: */
175: public void testSetDigit() {
176: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
177: char value = dfs.getDigit();
178: char value1 = (char) (value + 1);
179: dfs.setDigit(value1);
180: char result = dfs.getDigit();
181: assertNotEqual(value, result);
182: assertEquals(value1, result);
183: }
184:
185: /*
186: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getPatternSeparator()'
187: */
188: public void testGetPatternSeparator() {
189: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
190: assertEquals(';', dfs.getPatternSeparator());
191: }
192:
193: /*
194: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setPatternSeparator(char)'
195: */
196: public void testSetPatternSeparator() {
197: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
198: char value = dfs.getPatternSeparator();
199: char value1 = (char) (value + 1);
200: dfs.setPatternSeparator(value1);
201: char result = dfs.getPatternSeparator();
202: assertNotEqual(value, result);
203: assertEquals(value1, result);
204: }
205:
206: /*
207: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getInfinity()'
208: */
209: public void testGetInfinity() {
210: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
211: assertEquals("\u221e", dfs.getInfinity());
212: }
213:
214: /*
215: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setInfinity(String)'
216: */
217: public void testSetInfinity() {
218: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
219: String value = dfs.getInfinity();
220: String value1 = value + "!";
221: dfs.setInfinity(value1);
222: String result = dfs.getInfinity();
223: assertNotEqual(value, result);
224: assertEquals(value1, result);
225: }
226:
227: /*
228: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getNaN()'
229: */
230: public void testGetNaN() {
231: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
232: assertNotNull(dfs.getNaN()); // java returns missing character???
233: }
234:
235: /*
236: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setNaN(String)'
237: */
238: public void testSetNaN() {
239: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
240: String value = dfs.getNaN();
241: String value1 = value + "!";
242: dfs.setNaN(value1);
243: String result = dfs.getNaN();
244: assertNotEqual(value, result);
245: assertEquals(value1, result);
246: }
247:
248: /*
249: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getMinusSign()'
250: */
251: public void testGetMinusSign() {
252: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
253: assertEquals('-', dfs.getMinusSign());
254: }
255:
256: /*
257: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setMinusSign(char)'
258: */
259: public void testSetMinusSign() {
260: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
261: char value = dfs.getMinusSign();
262: char value1 = (char) (value + 1);
263: dfs.setMinusSign(value1);
264: char result = dfs.getMinusSign();
265: assertNotEqual(value, result);
266: assertEquals(value1, result);
267: }
268:
269: /*
270: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getCurrencySymbol()'
271: */
272: public void testGetCurrencySymbol() {
273: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
274: assertEquals("$", dfs.getCurrencySymbol());
275: }
276:
277: /*
278: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setCurrencySymbol(String)'
279: */
280: public void testSetCurrencySymbol() {
281: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
282: String value = dfs.getCurrencySymbol();
283: String value1 = value + "!";
284: dfs.setCurrencySymbol(value1);
285: String result = dfs.getCurrencySymbol();
286: assertNotEqual(value, result);
287: assertEquals(value1, result);
288: }
289:
290: /*
291: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getInternationalCurrencySymbol()'
292: */
293: public void testGetInternationalCurrencySymbol() {
294: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
295: assertEquals("USD", dfs.getInternationalCurrencySymbol());
296: }
297:
298: /*
299: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setInternationalCurrencySymbol(String)'
300: */
301: public void testSetInternationalCurrencySymbol() {
302: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
303: String value = dfs.getInternationalCurrencySymbol();
304: String value1 = value + "!";
305: dfs.setInternationalCurrencySymbol(value1);
306: String result = dfs.getInternationalCurrencySymbol();
307: assertNotEqual(value, result);
308: assertEquals(value1, result);
309: }
310:
311: /*
312: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.getMonetaryDecimalSeparator()'
313: */
314: public void testGetMonetaryDecimalSeparator() {
315: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
316: assertEquals('.', dfs.getMonetaryDecimalSeparator());
317: }
318:
319: /*
320: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.setMonetaryDecimalSeparator(char)'
321: */
322: public void testSetMonetaryDecimalSeparator() {
323: DecimalFormatSymbols dfs = new DecimalFormatSymbols(ULocale.US);
324: char value = dfs.getMonetaryDecimalSeparator();
325: char value1 = (char) (value + 1);
326: dfs.setMonetaryDecimalSeparator(value1);
327: char result = dfs.getMonetaryDecimalSeparator();
328: assertNotEqual(value, result);
329: assertEquals(value1, result);
330: }
331:
332: /*
333: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.clone()'
334: */
335: public void testClone() {
336: // tested in testHashcode
337: }
338:
339: /*
340: * Test method for 'com.ibm.icu.text.DecimalFormatSymbols.equals(Object)'
341: */
342: public void testEqualsObject() {
343: // tested in testHashcode
344: }
345: }
|