1   /*
2    * Copyright 2004-2005 The Apache Software Foundation.
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  
17  package org.apache.commons.configuration;
18  
19  import java.awt.*;
20  import java.math.BigDecimal;
21  import java.math.BigInteger;
22  import java.net.URL;
23  import java.text.DateFormat;
24  import java.text.SimpleDateFormat;
25  import java.util.ArrayList;
26  import java.util.Calendar;
27  import java.util.Date;
28  import java.util.List;
29  import java.util.Locale;
30  
31  import junit.framework.TestCase;
32  import junitx.framework.ArrayAssert;
33  import junitx.framework.ListAssert;
34  
35  /***
36   * @author Emmanuel Bourg
37   * @version $Revision$, $Date: 2005-09-27 15:06:23 +0200 (Tue, 27 Sep 2005) $
38   */
39  public class TestDataConfiguration extends TestCase
40  {
41      private DataConfiguration conf;
42  
43      protected void setUp() throws Exception
44      {
45          conf = new DataConfiguration(new BaseConfiguration());
46  
47          // empty value
48          conf.addProperty("empty", "");
49  
50          // lists of boolean
51          conf.addProperty("boolean.list1", "true");
52          conf.addProperty("boolean.list1", "false");
53          conf.addProperty("boolean.list2", "true, false");
54          conf.addProperty("boolean.list3", Boolean.TRUE);
55          conf.addProperty("boolean.list3", Boolean.FALSE);
56          conf.addProperty("boolean.list4", new Boolean[] { Boolean.TRUE, Boolean.FALSE });
57          conf.addProperty("boolean.list5", new boolean[] { true, false });
58          List booleans = new ArrayList();
59          booleans.add(Boolean.TRUE);
60          booleans.add(Boolean.FALSE);
61          conf.addProperty("boolean.list6", booleans);
62          conf.addProperty("boolean.string", "true");
63          conf.addProperty("boolean.object", Boolean.TRUE);
64          conf.addProperty("boolean.list.interpolated", "${boolean.string},false");
65  
66          // lists of bytes
67          conf.addProperty("byte.list1", "1");
68          conf.addProperty("byte.list1", "2");
69          conf.addProperty("byte.list2", "1, 2");
70          conf.addProperty("byte.list3", new Byte("1"));
71          conf.addProperty("byte.list3", new Byte("2"));
72          conf.addProperty("byte.list4", new Byte[] { new Byte("1"), new Byte("2") });
73          conf.addProperty("byte.list5", new byte[] { 1, 2 });
74          List bytes = new ArrayList();
75          bytes.add(new Byte("1"));
76          bytes.add(new Byte("2"));
77          conf.addProperty("byte.list6", bytes);
78          conf.addProperty("byte.string", "1");
79          conf.addProperty("byte.object", new Byte("1"));
80          conf.addProperty("byte.list.interpolated", "${byte.string},2");
81  
82          // lists of shorts
83          conf.addProperty("short.list1", "1");
84          conf.addProperty("short.list1", "2");
85          conf.addProperty("short.list2", "1, 2");
86          conf.addProperty("short.list3", new Short("1"));
87          conf.addProperty("short.list3", new Short("2"));
88          conf.addProperty("short.list4", new Short[] { new Short("1"), new Short("2") });
89          conf.addProperty("short.list5", new short[] { 1, 2 });
90          List shorts = new ArrayList();
91          shorts.add(new Short("1"));
92          shorts.add(new Short("2"));
93          conf.addProperty("short.list6", shorts);
94          conf.addProperty("short.string", "1");
95          conf.addProperty("short.object", new Short("1"));
96          conf.addProperty("short.list.interpolated", "${short.string},2");
97  
98          // lists of integers
99          conf.addProperty("integer.list1", "1");
100         conf.addProperty("integer.list1", "2");
101         conf.addProperty("integer.list2", "1, 2");
102         conf.addProperty("integer.list3", new Integer("1"));
103         conf.addProperty("integer.list3", new Integer("2"));
104         conf.addProperty("integer.list4", new Integer[] { new Integer("1"), new Integer("2") });
105         conf.addProperty("integer.list5", new int[] { 1, 2 });
106         List integers = new ArrayList();
107         integers.add(new Integer("1"));
108         integers.add(new Integer("2"));
109         conf.addProperty("integer.list6", integers);
110         conf.addProperty("integer.string", "1");
111         conf.addProperty("integer.object", new Integer("1"));
112         conf.addProperty("integer.list.interpolated", "${integer.string},2");
113 
114         // lists of longs
115         conf.addProperty("long.list1", "1");
116         conf.addProperty("long.list1", "2");
117         conf.addProperty("long.list2", "1, 2");
118         conf.addProperty("long.list3", new Long("1"));
119         conf.addProperty("long.list3", new Long("2"));
120         conf.addProperty("long.list4", new Long[] { new Long("1"), new Long("2") });
121         conf.addProperty("long.list5", new long[] { 1, 2 });
122         List longs = new ArrayList();
123         longs.add(new Long("1"));
124         longs.add(new Long("2"));
125         conf.addProperty("long.list6", longs);
126         conf.addProperty("long.string", "1");
127         conf.addProperty("long.object", new Long("1"));
128         conf.addProperty("long.list.interpolated", "${long.string},2");
129 
130         // lists of floats
131         conf.addProperty("float.list1", "1");
132         conf.addProperty("float.list1", "2");
133         conf.addProperty("float.list2", "1, 2");
134         conf.addProperty("float.list3", new Float("1"));
135         conf.addProperty("float.list3", new Float("2"));
136         conf.addProperty("float.list4", new Float[] { new Float("1"), new Float("2") });
137         conf.addProperty("float.list5", new float[] { 1, 2 });
138         List floats = new ArrayList();
139         floats.add(new Float("1"));
140         floats.add(new Float("2"));
141         conf.addProperty("float.list6", floats);
142         conf.addProperty("float.string", "1");
143         conf.addProperty("float.object", new Float("1"));
144         conf.addProperty("float.list.interpolated", "${float.string},2");
145 
146         // lists of doubles
147         conf.addProperty("double.list1", "1");
148         conf.addProperty("double.list1", "2");
149         conf.addProperty("double.list2", "1, 2");
150         conf.addProperty("double.list3", new Double("1"));
151         conf.addProperty("double.list3", new Double("2"));
152         conf.addProperty("double.list4", new Double[] { new Double("1"), new Double("2") });
153         conf.addProperty("double.list5", new double[] { 1, 2 });
154         List doubles = new ArrayList();
155         doubles.add(new Double("1"));
156         doubles.add(new Double("2"));
157         conf.addProperty("double.list6", doubles);
158         conf.addProperty("double.string", "1");
159         conf.addProperty("double.object", new Double("1"));
160         conf.addProperty("double.list.interpolated", "${double.string},2");
161 
162         // lists of big integers
163         conf.addProperty("biginteger.list1", "1");
164         conf.addProperty("biginteger.list1", "2");
165         conf.addProperty("biginteger.list2", "1, 2");
166         conf.addProperty("biginteger.list3", new BigInteger("1"));
167         conf.addProperty("biginteger.list3", new BigInteger("2"));
168         conf.addProperty("biginteger.list4", new BigInteger[] { new BigInteger("1"), new BigInteger("2") });
169         List bigintegers = new ArrayList();
170         bigintegers.add(new BigInteger("1"));
171         bigintegers.add(new BigInteger("2"));
172         conf.addProperty("biginteger.list6", bigintegers);
173         conf.addProperty("biginteger.string", "1");
174         conf.addProperty("biginteger.object", new BigInteger("1"));
175         conf.addProperty("biginteger.list.interpolated", "${biginteger.string},2");
176 
177         // lists of big decimals
178         conf.addProperty("bigdecimal.list1", "1");
179         conf.addProperty("bigdecimal.list1", "2");
180         conf.addProperty("bigdecimal.list2", "1, 2");
181         conf.addProperty("bigdecimal.list3", new BigDecimal("1"));
182         conf.addProperty("bigdecimal.list3", new BigDecimal("2"));
183         conf.addProperty("bigdecimal.list4", new BigDecimal[] { new BigDecimal("1"), new BigDecimal("2") });
184         List bigdecimals = new ArrayList();
185         bigdecimals.add(new BigDecimal("1"));
186         bigdecimals.add(new BigDecimal("2"));
187         conf.addProperty("bigdecimal.list6", bigdecimals);
188         conf.addProperty("bigdecimal.string", "1");
189         conf.addProperty("bigdecimal.object", new BigDecimal("1"));
190         conf.addProperty("bigdecimal.list.interpolated", "${bigdecimal.string},2");
191 
192         // URLs
193         String url1 = "http://jakarta.apache.org";
194         String url2 = "http://www.apache.org";
195         conf.addProperty("url.string", url1);
196         conf.addProperty("url.string.interpolated", "${url.string}");
197         conf.addProperty("url.object", new URL(url1));
198         conf.addProperty("url.list1", url1);
199         conf.addProperty("url.list1", url2);
200         conf.addProperty("url.list2", url1 + ", " + url2);
201         conf.addProperty("url.list3", new URL(url1));
202         conf.addProperty("url.list3", new URL(url2));
203         conf.addProperty("url.list4", new URL[] { new URL(url1), new URL(url2) });
204         List urls = new ArrayList();
205         urls.add(new URL(url1));
206         urls.add(new URL(url2));
207         conf.addProperty("url.list6", urls);
208         conf.addProperty("url.list.interpolated", "${url.string}," + url2);
209 
210         // Locales
211         conf.addProperty("locale.string", "fr");
212         conf.addProperty("locale.string.interpolated", "${locale.string}");
213         conf.addProperty("locale.object", Locale.FRENCH);
214         conf.addProperty("locale.list1", "fr");
215         conf.addProperty("locale.list1", "de");
216         conf.addProperty("locale.list2", "fr, de");
217         conf.addProperty("locale.list3", Locale.FRENCH);
218         conf.addProperty("locale.list3", Locale.GERMAN);
219         conf.addProperty("locale.list4", new Locale[] { Locale.FRENCH, Locale.GERMAN });
220         List locales = new ArrayList();
221         locales.add(Locale.FRENCH);
222         locales.add(Locale.GERMAN);
223         conf.addProperty("locale.list6", locales);
224         conf.addProperty("locale.list.interpolated", "${locale.string},de");
225 
226         // Colors
227         String color1 = "FF0000";
228         String color2 = "0000FF";
229         conf.addProperty("color.string", color1);
230         conf.addProperty("color.string.interpolated", "${color.string}");
231         conf.addProperty("color.object", Color.red);
232         conf.addProperty("color.list1", color1);
233         conf.addProperty("color.list1", color2);
234         conf.addProperty("color.list2", color1 + ", " + color2);
235         conf.addProperty("color.list3", Color.red);
236         conf.addProperty("color.list3", Color.blue);
237         conf.addProperty("color.list4", new Color[] { Color.red, Color.blue });
238         List colors = new ArrayList();
239         colors.add(Color.red);
240         colors.add(Color.blue);
241         conf.addProperty("color.list6", colors);
242         conf.addProperty("color.list.interpolated", "${color.string}," + color2);
243 
244         // Dates & Calendars
245         String pattern = "yyyy-MM-dd";
246         DateFormat format = new SimpleDateFormat(pattern);
247         conf.setProperty(DataConfiguration.DATE_FORMAT_KEY, pattern);
248 
249         Date date1 = format.parse("2004-01-01");
250         Date date2 = format.parse("2004-12-31");
251         Calendar calendar1 = Calendar.getInstance();
252         calendar1.setTime(date1);
253         Calendar calendar2 = Calendar.getInstance();
254         calendar2.setTime(date2);
255 
256         conf.addProperty("date.string", "2004-01-01");
257         conf.addProperty("date.string.interpolated", "${date.string}");
258         conf.addProperty("date.object", date1);
259         conf.addProperty("date.list1", "2004-01-01");
260         conf.addProperty("date.list1", "2004-12-31");
261         conf.addProperty("date.list2", "2004-01-01, 2004-12-31");
262         conf.addProperty("date.list3", date1);
263         conf.addProperty("date.list3", date2);
264         conf.addProperty("date.list4", new Date[] { date1, date2 });
265         conf.addProperty("date.list5", new Calendar[] { calendar1, calendar2 });
266         List dates = new ArrayList();
267         dates.add(date1);
268         dates.add(date2);
269         conf.addProperty("date.list6", dates);
270         conf.addProperty("date.list.interpolated", "${date.string},2004-12-31");
271 
272         conf.addProperty("calendar.string", "2004-01-01");
273         conf.addProperty("calendar.string.interpolated", "${calendar.string}");
274         conf.addProperty("calendar.object", calendar1);
275         conf.addProperty("calendar.list1", "2004-01-01");
276         conf.addProperty("calendar.list1", "2004-12-31");
277         conf.addProperty("calendar.list2", "2004-01-01, 2004-12-31");
278         conf.addProperty("calendar.list3", calendar1);
279         conf.addProperty("calendar.list3", calendar2);
280         conf.addProperty("calendar.list4", new Calendar[] { calendar1, calendar2 });
281         conf.addProperty("calendar.list5", new Date[] { date1, date2 });
282         List calendars = new ArrayList();
283         calendars.add(date1);
284         calendars.add(date2);
285         conf.addProperty("calendar.list6", calendars);
286         conf.addProperty("calendar.list.interpolated", "${calendar.string},2004-12-31");
287     }
288 
289     public void testGetBooleanArray()
290     {
291         // missing list
292         boolean[] defaultValue = new boolean[] { false, true };
293         ArrayAssert.assertEquals(defaultValue, conf.getBooleanArray("boolean.list", defaultValue));
294 
295         boolean[] expected = new boolean[] { true, false };
296 
297         // list of strings
298         ArrayAssert.assertEquals(expected, conf.getBooleanArray("boolean.list1"));
299 
300         // list of strings, comma separated
301         ArrayAssert.assertEquals(expected, conf.getBooleanArray("boolean.list2"));
302 
303         // list of Boolean objects
304         ArrayAssert.assertEquals(expected, conf.getBooleanArray("boolean.list3"));
305 
306         // array of Boolean objects
307         ArrayAssert.assertEquals(expected, conf.getBooleanArray("boolean.list4"));
308 
309         // array of boolean primitives
310         ArrayAssert.assertEquals(expected, conf.getBooleanArray("boolean.list5"));
311 
312         // list of Boolean objects
313         ArrayAssert.assertEquals(expected, conf.getBooleanArray("boolean.list6"));
314 
315         // list of interpolated values
316         ArrayAssert.assertEquals(expected, conf.getBooleanArray("boolean.list.interpolated"));
317 
318         // single boolean values
319         ArrayAssert.assertEquals(new boolean[] { true }, conf.getBooleanArray("boolean.string"));
320         ArrayAssert.assertEquals(new boolean[] { true }, conf.getBooleanArray("boolean.object"));
321 
322         // empty array
323         ArrayAssert.assertEquals(new boolean[] { }, conf.getBooleanArray("empty"));
324     }
325 
326     public void testGetBooleanList()
327     {
328         // missing list
329         ListAssert.assertEquals(null, conf.getBooleanList("boolean.list", null));
330 
331         List expected = new ArrayList();
332         expected.add(Boolean.TRUE);
333         expected.add(Boolean.FALSE);
334 
335         // list of strings
336         ListAssert.assertEquals(expected, conf.getBooleanList("boolean.list1"));
337 
338         // list of strings, comma separated
339         ListAssert.assertEquals(expected, conf.getBooleanList("boolean.list2"));
340 
341         // list of Boolean objects
342         ListAssert.assertEquals(expected, conf.getBooleanList("boolean.list3"));
343 
344         // array of Boolean objects
345         ListAssert.assertEquals(expected, conf.getBooleanList("boolean.list4"));
346 
347         // array of boolean primitives
348         ListAssert.assertEquals(expected, conf.getBooleanList("boolean.list5"));
349 
350         // list of Boolean objects
351         ListAssert.assertEquals(expected, conf.getBooleanList("boolean.list6"));
352 
353         // list of interpolated values
354         ListAssert.assertEquals(expected, conf.getBooleanList("boolean.list.interpolated"));
355 
356         // single boolean values
357         expected = new ArrayList();
358         expected.add(Boolean.TRUE);
359         ListAssert.assertEquals(expected, conf.getBooleanList("boolean.string"));
360         ListAssert.assertEquals(expected, conf.getBooleanList("boolean.object"));
361 
362         // empty list
363         ListAssert.assertEquals(new ArrayList(), conf.getBooleanList("empty"));
364     }
365 
366     public void testGetByteArray()
367     {
368         // missing list
369         byte[] defaultValue = new byte[] { 1, 2};
370         ArrayAssert.assertEquals(defaultValue, conf.getByteArray("byte.list", defaultValue));
371 
372         byte[] expected = new byte[] { 1, 2 };
373 
374         // list of strings
375         ArrayAssert.assertEquals(expected, conf.getByteArray("byte.list1"));
376 
377         // list of strings, comma separated
378         ArrayAssert.assertEquals(expected, conf.getByteArray("byte.list2"));
379 
380         // list of Byte objects
381         ArrayAssert.assertEquals(expected, conf.getByteArray("byte.list3"));
382 
383         // array of Byte objects
384         ArrayAssert.assertEquals(expected, conf.getByteArray("byte.list4"));
385 
386         // array of byte primitives
387         ArrayAssert.assertEquals(expected, conf.getByteArray("byte.list5"));
388 
389         // list of Byte objects
390         ArrayAssert.assertEquals(expected, conf.getByteArray("byte.list6"));
391 
392         // list of interpolated values
393         ArrayAssert.assertEquals(expected, conf.getByteArray("byte.list.interpolated"));
394 
395         // single byte values
396         ArrayAssert.assertEquals(new byte[] { 1 }, conf.getByteArray("byte.string"));
397         ArrayAssert.assertEquals(new byte[] { 1 }, conf.getByteArray("byte.object"));
398 
399         // empty array
400         ArrayAssert.assertEquals(new byte[] { }, conf.getByteArray("empty"));
401     }
402 
403     public void testGetByteList()
404     {
405         // missing list
406         ListAssert.assertEquals(null, conf.getByteList("byte.list", null));
407 
408         List expected = new ArrayList();
409         expected.add(new Byte("1"));
410         expected.add(new Byte("2"));
411 
412         // list of strings
413         ListAssert.assertEquals(expected, conf.getByteList("byte.list1"));
414 
415         // list of strings, comma separated
416         ListAssert.assertEquals(expected, conf.getByteList("byte.list2"));
417 
418         // list of Byte objects
419         ListAssert.assertEquals(expected, conf.getByteList("byte.list3"));
420 
421         // array of Byte objects
422         ListAssert.assertEquals(expected, conf.getByteList("byte.list4"));
423 
424         // array of byte primitives
425         ListAssert.assertEquals(expected, conf.getByteList("byte.list5"));
426 
427         // list of Byte objects
428         ListAssert.assertEquals(expected, conf.getByteList("byte.list6"));
429 
430         // list of interpolated values
431         ListAssert.assertEquals(expected, conf.getByteList("byte.list.interpolated"));
432 
433         // single byte values
434         expected = new ArrayList();
435         expected.add(new Byte("1"));
436         ListAssert.assertEquals(expected, conf.getByteList("byte.string"));
437         ListAssert.assertEquals(expected, conf.getByteList("byte.object"));
438 
439         // empty list
440         ListAssert.assertEquals(new ArrayList(), conf.getByteList("empty"));
441     }
442 
443     public void testGetShortArray()
444     {
445         // missing list
446         short[] defaultValue = new short[] { 2, 1};
447         ArrayAssert.assertEquals(defaultValue, conf.getShortArray("short.list", defaultValue));
448 
449         short[] expected = new short[] { 1, 2 };
450 
451         // list of strings
452         ArrayAssert.assertEquals(expected, conf.getShortArray("short.list1"));
453 
454         // list of strings, comma separated
455         ArrayAssert.assertEquals(expected, conf.getShortArray("short.list2"));
456 
457         // list of Byte objects
458         ArrayAssert.assertEquals(expected, conf.getShortArray("short.list3"));
459 
460         // array of Byte objects
461         ArrayAssert.assertEquals(expected, conf.getShortArray("short.list4"));
462 
463         // array of byte primitives
464         ArrayAssert.assertEquals(expected, conf.getShortArray("short.list5"));
465 
466         // list of Byte objects
467         ArrayAssert.assertEquals(expected, conf.getShortArray("short.list6"));
468 
469         // list of interpolated values
470         ArrayAssert.assertEquals(expected, conf.getShortArray("short.list.interpolated"));
471 
472         // single byte values
473         ArrayAssert.assertEquals(new short[] { 1 }, conf.getShortArray("short.string"));
474         ArrayAssert.assertEquals(new short[] { 1 }, conf.getShortArray("short.object"));
475 
476         // empty array
477         ArrayAssert.assertEquals(new short[] { }, conf.getShortArray("empty"));
478     }
479 
480     public void testGetShortList()
481     {
482         // missing list
483         ListAssert.assertEquals(null, conf.getShortList("short.list", null));
484 
485         List expected = new ArrayList();
486         expected.add(new Short("1"));
487         expected.add(new Short("2"));
488 
489         // list of strings
490         ListAssert.assertEquals(expected, conf.getShortList("short.list1"));
491 
492         // list of strings, comma separated
493         ListAssert.assertEquals(expected, conf.getShortList("short.list2"));
494 
495         // list of Short objects
496         ListAssert.assertEquals(expected, conf.getShortList("short.list3"));
497 
498         // array of Short objects
499         ListAssert.assertEquals(expected, conf.getShortList("short.list4"));
500 
501         // array of short primitives
502         ListAssert.assertEquals(expected, conf.getShortList("short.list5"));
503 
504         // list of Short objects
505         ListAssert.assertEquals(expected, conf.getShortList("short.list6"));
506 
507         // list of interpolated values
508         ListAssert.assertEquals(expected, conf.getShortList("short.list.interpolated"));
509 
510         // single short values
511         expected = new ArrayList();
512         expected.add(new Short("1"));
513         ListAssert.assertEquals(expected, conf.getShortList("short.string"));
514         ListAssert.assertEquals(expected, conf.getShortList("short.object"));
515 
516         // empty list
517         ListAssert.assertEquals(new ArrayList(), conf.getShortList("empty"));
518     }
519 
520     public void testGetIntegerArray()
521     {
522         // missing list
523         int[] defaultValue = new int[] { 2, 1};
524         ArrayAssert.assertEquals(defaultValue, conf.getIntArray("integer.list", defaultValue));
525 
526         int[] expected = new int[] { 1, 2 };
527 
528         // list of strings
529         ArrayAssert.assertEquals(expected, conf.getIntArray("integer.list1"));
530 
531         // list of strings, comma separated
532         ArrayAssert.assertEquals(expected, conf.getIntArray("integer.list2"));
533 
534         // list of Integer objects
535         ArrayAssert.assertEquals(expected, conf.getIntArray("integer.list3"));
536 
537         // array of Integer objects
538         ArrayAssert.assertEquals(expected, conf.getIntArray("integer.list4"));
539 
540         // array of int primitives
541         ArrayAssert.assertEquals(expected, conf.getIntArray("integer.list5"));
542 
543         // list of Integer objects
544         ArrayAssert.assertEquals(expected, conf.getIntArray("integer.list6"));
545 
546         // list of interpolated values
547         ArrayAssert.assertEquals(expected, conf.getIntArray("integer.list.interpolated"));
548 
549         // single int values
550         ArrayAssert.assertEquals(new int[] { 1 }, conf.getIntArray("integer.string"));
551         ArrayAssert.assertEquals(new int[] { 1 }, conf.getIntArray("integer.object"));
552 
553         // empty array
554         ArrayAssert.assertEquals(new int[] { }, conf.getIntArray("empty"));
555     }
556 
557     public void testGetIntegerList()
558     {
559         // missing list
560         ListAssert.assertEquals(null, conf.getIntegerList("integer.list", null));
561 
562         List expected = new ArrayList();
563         expected.add(new Integer("1"));
564         expected.add(new Integer("2"));
565 
566         // list of strings
567         ListAssert.assertEquals(expected, conf.getIntegerList("integer.list1"));
568 
569         // list of strings, comma separated
570         ListAssert.assertEquals(expected, conf.getIntegerList("integer.list2"));
571 
572         // list of Integer objects
573         ListAssert.assertEquals(expected, conf.getIntegerList("integer.list3"));
574 
575         // array of Integer objects
576         ListAssert.assertEquals(expected, conf.getIntegerList("integer.list4"));
577 
578         // array of int primitives
579         ListAssert.assertEquals(expected, conf.getIntegerList("integer.list5"));
580 
581         // list of Integer objects
582         ListAssert.assertEquals(expected, conf.getIntegerList("integer.list6"));
583 
584         // list of interpolated values
585         ListAssert.assertEquals(expected, conf.getIntegerList("integer.list.interpolated"));
586 
587         // single int values
588         expected = new ArrayList();
589         expected.add(new Integer("1"));
590         ListAssert.assertEquals(expected, conf.getIntegerList("integer.string"));
591         ListAssert.assertEquals(expected, conf.getIntegerList("integer.object"));
592 
593         // empty list
594         ListAssert.assertEquals(new ArrayList(), conf.getIntegerList("empty"));
595     }
596 
597     public void testGetLongArray()
598     {
599         // missing list
600         long[] defaultValue = new long[] { 2, 1};
601         ArrayAssert.assertEquals(defaultValue, conf.getLongArray("long.list", defaultValue));
602 
603         long[] expected = new long[] { 1, 2 };
604 
605         // list of strings
606         ArrayAssert.assertEquals(expected, conf.getLongArray("long.list1"));
607 
608         // list of strings, comma separated
609         ArrayAssert.assertEquals(expected, conf.getLongArray("long.list2"));
610 
611         // list of Long objects
612         ArrayAssert.assertEquals(expected, conf.getLongArray("long.list3"));
613 
614         // array of Long objects
615         ArrayAssert.assertEquals(expected, conf.getLongArray("long.list4"));
616 
617         // array of long primitives
618         ArrayAssert.assertEquals(expected, conf.getLongArray("long.list5"));
619 
620         // list of Long objects
621         ArrayAssert.assertEquals(expected, conf.getLongArray("long.list6"));
622 
623         // list of interpolated values
624         ArrayAssert.assertEquals(expected, conf.getLongArray("long.list.interpolated"));
625 
626         // single long values
627         ArrayAssert.assertEquals(new long[] { 1 }, conf.getLongArray("long.string"));
628         ArrayAssert.assertEquals(new long[] { 1 }, conf.getLongArray("long.object"));
629 
630         // empty array
631         ArrayAssert.assertEquals(new long[] { }, conf.getLongArray("empty"));
632     }
633 
634     public void testGetLongList()
635     {
636         // missing list
637         ListAssert.assertEquals(null, conf.getLongList("long.list", null));
638 
639         List expected = new ArrayList();
640         expected.add(new Long("1"));
641         expected.add(new Long("2"));
642 
643         // list of strings
644         ListAssert.assertEquals(expected, conf.getLongList("long.list1"));
645 
646         // list of strings, comma separated
647         ListAssert.assertEquals(expected, conf.getLongList("long.list2"));
648 
649         // list of Long objects
650         ListAssert.assertEquals(expected, conf.getLongList("long.list3"));
651 
652         // array of Long objects
653         ListAssert.assertEquals(expected, conf.getLongList("long.list4"));
654 
655         // array of long primitives
656         ListAssert.assertEquals(expected, conf.getLongList("long.list5"));
657 
658         // list of Long objects
659         ListAssert.assertEquals(expected, conf.getLongList("long.list6"));
660 
661         // list of interpolated values
662         ListAssert.assertEquals(expected, conf.getLongList("long.list.interpolated"));
663 
664         // single long values
665         expected = new ArrayList();
666         expected.add(new Long("1"));
667         ListAssert.assertEquals(expected, conf.getLongList("long.string"));
668         ListAssert.assertEquals(expected, conf.getLongList("long.object"));
669 
670         // empty list
671         ListAssert.assertEquals(new ArrayList(), conf.getLongList("empty"));
672     }
673 
674     public void testGetFloatArray()
675     {
676         // missing list
677         float[] defaultValue = new float[] { 2, 1};
678         ArrayAssert.assertEquals(defaultValue, conf.getFloatArray("float.list", defaultValue), 0);
679 
680         float[] expected = new float[] { 1, 2 };
681 
682         // list of strings
683         ArrayAssert.assertEquals(expected, conf.getFloatArray("float.list1"), 0);
684 
685         // list of strings, comma separated
686         ArrayAssert.assertEquals(expected, conf.getFloatArray("float.list2"), 0);
687 
688         // list of Float objects
689         ArrayAssert.assertEquals(expected, conf.getFloatArray("float.list3"), 0);
690 
691         // array of Float objects
692         ArrayAssert.assertEquals(expected, conf.getFloatArray("float.list4"), 0);
693 
694         // array of float primitives
695         ArrayAssert.assertEquals(expected, conf.getFloatArray("float.list5"), 0);
696 
697         // list of Float objects
698         ArrayAssert.assertEquals(expected, conf.getFloatArray("float.list6"), 0);
699 
700         // list of interpolated values
701         ArrayAssert.assertEquals(expected, conf.getFloatArray("float.list.interpolated"), 0);
702 
703         // single float values
704         ArrayAssert.assertEquals(new float[] { 1 }, conf.getFloatArray("float.string"), 0);
705         ArrayAssert.assertEquals(new float[] { 1 }, conf.getFloatArray("float.object"), 0);
706 
707         // empty array
708         ArrayAssert.assertEquals(new float[] { }, conf.getFloatArray("empty"), 0);
709     }
710 
711     public void testGetFloatList()
712     {
713         // missing list
714         ListAssert.assertEquals(null, conf.getFloatList("float.list", null));
715 
716         List expected = new ArrayList();
717         expected.add(new Float("1"));
718         expected.add(new Float("2"));
719 
720         // list of strings
721         ListAssert.assertEquals(expected, conf.getFloatList("float.list1"));
722 
723         // list of strings, comma separated
724         ListAssert.assertEquals(expected, conf.getFloatList("float.list2"));
725 
726         // list of Float objects
727         ListAssert.assertEquals(expected, conf.getFloatList("float.list3"));
728 
729         // array of Float objects
730         ListAssert.assertEquals(expected, conf.getFloatList("float.list4"));
731 
732         // array of float primitives
733         ListAssert.assertEquals(expected, conf.getFloatList("float.list5"));
734 
735         // list of Float objects
736         ListAssert.assertEquals(expected, conf.getFloatList("float.list6"));
737 
738         // list of interpolated values
739         ListAssert.assertEquals(expected, conf.getFloatList("float.list.interpolated"));
740 
741         // single float values
742         expected = new ArrayList();
743         expected.add(new Float("1"));
744         ListAssert.assertEquals(expected, conf.getFloatList("float.string"));
745         ListAssert.assertEquals(expected, conf.getFloatList("float.object"));
746 
747         // empty list
748         ListAssert.assertEquals(new ArrayList(), conf.getFloatList("empty"));
749     }
750 
751     public void testGetDoubleArray()
752     {
753         // missing list
754         double[] defaultValue = new double[] { 2, 1 };
755         ArrayAssert.assertEquals(defaultValue, conf.getDoubleArray("double.list", defaultValue), 0);
756 
757         double[] expected = new double[] { 1, 2 };
758 
759         // list of strings
760         ArrayAssert.assertEquals(expected, conf.getDoubleArray("double.list1"), 0);
761 
762         // list of strings, comma separated
763         ArrayAssert.assertEquals(expected, conf.getDoubleArray("double.list2"), 0);
764 
765         // list of Double objects
766         ArrayAssert.assertEquals(expected, conf.getDoubleArray("double.list3"), 0);
767 
768         // array of Double objects
769         ArrayAssert.assertEquals(expected, conf.getDoubleArray("double.list4"), 0);
770 
771         // array of double primitives
772         ArrayAssert.assertEquals(expected, conf.getDoubleArray("double.list5"), 0);
773 
774         // list of Double objects
775         ArrayAssert.assertEquals(expected, conf.getDoubleArray("double.list6"), 0);
776 
777         // list of interpolated values
778         ArrayAssert.assertEquals(expected, conf.getDoubleArray("double.list.interpolated"), 0);
779 
780         // single double values
781         ArrayAssert.assertEquals(new double[] { 1 }, conf.getDoubleArray("double.string"), 0);
782         ArrayAssert.assertEquals(new double[] { 1 }, conf.getDoubleArray("double.object"), 0);
783 
784         // empty array
785         ArrayAssert.assertEquals(new double[] { }, conf.getDoubleArray("empty"), 0);
786     }
787 
788     public void testGetDoubleList()
789     {
790         // missing list
791         ListAssert.assertEquals(null, conf.getDoubleList("double.list", null));
792 
793         List expected = new ArrayList();
794         expected.add(new Double("1"));
795         expected.add(new Double("2"));
796 
797         // list of strings
798         ListAssert.assertEquals(expected, conf.getDoubleList("double.list1"));
799 
800         // list of strings, comma separated
801         ListAssert.assertEquals(expected, conf.getDoubleList("double.list2"));
802 
803         // list of Double objects
804         ListAssert.assertEquals(expected, conf.getDoubleList("double.list3"));
805 
806         // array of Double objects
807         ListAssert.assertEquals(expected, conf.getDoubleList("double.list4"));
808 
809         // array of double primitives
810         ListAssert.assertEquals(expected, conf.getDoubleList("double.list5"));
811 
812         // list of Double objects
813         ListAssert.assertEquals(expected, conf.getDoubleList("double.list6"));
814 
815         // list of interpolated values
816         ListAssert.assertEquals(expected, conf.getDoubleList("double.list.interpolated"));
817 
818         // single double values
819         expected = new ArrayList();
820         expected.add(new Double("1"));
821         ListAssert.assertEquals(expected, conf.getDoubleList("double.string"));
822         ListAssert.assertEquals(expected, conf.getDoubleList("double.object"));
823 
824         // empty list
825         ListAssert.assertEquals(new ArrayList(), conf.getDoubleList("empty"));
826     }
827 
828     public void testGetBigIntegerArray()
829     {
830         // missing list
831         BigInteger[] defaultValue = new BigInteger[] { new BigInteger("2"), new BigInteger("1") };
832         ArrayAssert.assertEquals(defaultValue, conf.getBigIntegerArray("biginteger.list", defaultValue));
833 
834         BigInteger[] expected = new BigInteger[] { new BigInteger("1"), new BigInteger("2") };
835 
836         // list of strings
837         ArrayAssert.assertEquals(expected, conf.getBigIntegerArray("biginteger.list1"));
838 
839         // list of strings, comma separated
840         ArrayAssert.assertEquals(expected, conf.getBigIntegerArray("biginteger.list2"));
841 
842         // list of BigInteger objects
843         ArrayAssert.assertEquals(expected, conf.getBigIntegerArray("biginteger.list3"));
844 
845         // array of BigInteger objects
846         ArrayAssert.assertEquals(expected, conf.getBigIntegerArray("biginteger.list4"));
847 
848         // list of BigInteger objects
849         ArrayAssert.assertEquals(expected, conf.getBigIntegerArray("biginteger.list6"));
850 
851         // list of interpolated values
852         ArrayAssert.assertEquals(expected, conf.getBigIntegerArray("biginteger.list.interpolated"));
853 
854         // single BigInteger values
855         ArrayAssert.assertEquals(new BigInteger[] { new BigInteger("1") }, conf.getBigIntegerArray("biginteger.string"));
856         ArrayAssert.assertEquals(new BigInteger[] { new BigInteger("1") }, conf.getBigIntegerArray("biginteger.object"));
857 
858         // empty array
859         ArrayAssert.assertEquals(new BigInteger[] { }, conf.getBigIntegerArray("empty"));
860     }
861 
862     public void testGetBigIntegerList()
863     {
864         // missing list
865         ListAssert.assertEquals(null, conf.getBigIntegerList("biginteger.list", null));
866 
867         List expected = new ArrayList();
868         expected.add(new BigInteger("1"));
869         expected.add(new BigInteger("2"));
870 
871         // list of strings
872         ListAssert.assertEquals(expected, conf.getBigIntegerList("biginteger.list1"));
873 
874         // list of strings, comma separated
875         ListAssert.assertEquals(expected, conf.getBigIntegerList("biginteger.list2"));
876 
877         // list of BigInteger objects
878         ListAssert.assertEquals(expected, conf.getBigIntegerList("biginteger.list3"));
879 
880         // array of BigInteger objects
881         ListAssert.assertEquals(expected, conf.getBigIntegerList("biginteger.list4"));
882 
883         // list of BigInteger objects
884         ListAssert.assertEquals(expected, conf.getBigIntegerList("biginteger.list6"));
885 
886         // list of interpolated values
887         ListAssert.assertEquals(expected, conf.getBigIntegerList("biginteger.list.interpolated"));
888 
889         // single BigInteger values
890         expected = new ArrayList();
891         expected.add(new BigInteger("1"));
892         ListAssert.assertEquals(expected, conf.getBigIntegerList("biginteger.string"));
893         ListAssert.assertEquals(expected, conf.getBigIntegerList("biginteger.object"));
894 
895         // empty list
896         ListAssert.assertEquals(new ArrayList(), conf.getBigIntegerList("empty"));
897     }
898 
899     public void testGetBigDecimalArray()
900     {
901         // missing list
902         BigDecimal[] defaultValue = new BigDecimal[] { new BigDecimal("2"), new BigDecimal("1") };
903         ArrayAssert.assertEquals(defaultValue, conf.getBigDecimalArray("bigdecimal.list", defaultValue));
904 
905         BigDecimal[] expected = new BigDecimal[] { new BigDecimal("1"), new BigDecimal("2") };
906 
907         // list of strings
908         ArrayAssert.assertEquals(expected, conf.getBigDecimalArray("bigdecimal.list1"));
909 
910         // list of strings, comma separated
911         ArrayAssert.assertEquals(expected, conf.getBigDecimalArray("bigdecimal.list2"));
912 
913         // list of BigDecimal objects
914         ArrayAssert.assertEquals(expected, conf.getBigDecimalArray("bigdecimal.list3"));
915 
916         // array of BigDecimal objects
917         ArrayAssert.assertEquals(expected, conf.getBigDecimalArray("bigdecimal.list4"));
918 
919         // list of BigDecimal objects
920         ArrayAssert.assertEquals(expected, conf.getBigDecimalArray("bigdecimal.list6"));
921 
922         // list of interpolated values
923         ArrayAssert.assertEquals(expected, conf.getBigDecimalArray("bigdecimal.list.interpolated"));
924 
925         // single BigDecimal values
926         ArrayAssert.assertEquals(new BigDecimal[] { new BigDecimal("1") }, conf.getBigDecimalArray("bigdecimal.string"));
927         ArrayAssert.assertEquals(new BigDecimal[] { new BigDecimal("1") }, conf.getBigDecimalArray("bigdecimal.object"));
928 
929         // empty array
930         ArrayAssert.assertEquals(new BigDecimal[] { }, conf.getBigDecimalArray("empty"));
931     }
932 
933     public void testGetBigDecimalList()
934     {
935         // missing list
936         ListAssert.assertEquals(null, conf.getBigDecimalList("bigdecimal.list", null));
937 
938         List expected = new ArrayList();
939         expected.add(new BigDecimal("1"));
940         expected.add(new BigDecimal("2"));
941 
942         // list of strings
943         ListAssert.assertEquals(expected, conf.getBigDecimalList("bigdecimal.list1"));
944 
945         // list of strings, comma separated
946         ListAssert.assertEquals(expected, conf.getBigDecimalList("bigdecimal.list2"));
947 
948         // list of BigDecimal objects
949         ListAssert.assertEquals(expected, conf.getBigDecimalList("bigdecimal.list3"));
950 
951         // array of BigDecimal objects
952         ListAssert.assertEquals(expected, conf.getBigDecimalList("bigdecimal.list4"));
953 
954         // list of BigDecimal objects
955         ListAssert.assertEquals(expected, conf.getBigDecimalList("bigdecimal.list6"));
956 
957         // list of interpolated values
958         ListAssert.assertEquals(expected, conf.getBigDecimalList("bigdecimal.list.interpolated"));
959 
960         // single BigDecimal values
961         expected = new ArrayList();
962         expected.add(new BigDecimal("1"));
963         ListAssert.assertEquals(expected, conf.getBigDecimalList("bigdecimal.string"));
964         ListAssert.assertEquals(expected, conf.getBigDecimalList("bigdecimal.object"));
965 
966         // empty list
967         ListAssert.assertEquals(new ArrayList(), conf.getBigDecimalList("empty"));
968     }
969 
970     public void testGetURL() throws Exception
971     {
972         // missing URL
973         URL defaultValue = new URL("http://www.google.com");
974         assertEquals(defaultValue, conf.getURL("url", defaultValue));
975 
976         URL expected = new URL("http://jakarta.apache.org");
977 
978         // URL string
979         assertEquals(expected, conf.getURL("url.string"));
980 
981         // URL object
982         assertEquals(expected, conf.getURL("url.object"));
983 
984         // interpolated value
985         assertEquals(expected, conf.getURL("url.string.interpolated"));
986     }
987 
988     public void testGetURLArray() throws Exception
989     {
990         // missing list
991         URL[] defaultValue = new URL[] { new URL("http://www.apache.org"), new URL("http://jakarta.apache.org") };
992         ArrayAssert.assertEquals(defaultValue, conf.getURLArray("url.list", defaultValue));
993 
994         URL[] expected = new URL[] { new URL("http://jakarta.apache.org"), new URL("http://www.apache.org") };
995 
996         // list of strings
997         ArrayAssert.assertEquals(expected, conf.getURLArray("url.list1"));
998 
999         // list of strings, comma separated
1000         ArrayAssert.assertEquals(expected, conf.getURLArray("url.list2"));
1001 
1002         // list of URL objects
1003         ArrayAssert.assertEquals(expected, conf.getURLArray("url.list3"));
1004 
1005         // array of URL objects
1006         ArrayAssert.assertEquals(expected, conf.getURLArray("url.list4"));
1007 
1008         // list of URL objects
1009         ArrayAssert.assertEquals(expected, conf.getURLArray("url.list6"));
1010 
1011         // list of interpolated values
1012         ArrayAssert.assertEquals(expected, conf.getURLArray("url.list.interpolated"));
1013 
1014         // single URL values
1015         ArrayAssert.assertEquals(new URL[] { new URL("http://jakarta.apache.org") }, conf.getURLArray("url.string"));
1016         ArrayAssert.assertEquals(new URL[] { new URL("http://jakarta.apache.org") }, conf.getURLArray("url.object"));
1017 
1018         // empty array
1019         ArrayAssert.assertEquals(new URL[] { }, conf.getURLArray("empty"));
1020     }
1021 
1022     public void testGetURLList() throws Exception
1023     {
1024         // missing list
1025         ListAssert.assertEquals(null, conf.getURLList("url.list", null));
1026 
1027         List expected = new ArrayList();
1028         expected.add(new URL("http://jakarta.apache.org"));
1029         expected.add(new URL("http://www.apache.org"));
1030 
1031         // list of strings
1032         ListAssert.assertEquals(expected, conf.getURLList("url.list1"));
1033 
1034         // list of strings, comma separated
1035         ListAssert.assertEquals(expected, conf.getURLList("url.list2"));
1036 
1037         // list of URL objects
1038         ListAssert.assertEquals(expected, conf.getURLList("url.list3"));
1039 
1040         // array of URL objects
1041         ListAssert.assertEquals(expected, conf.getURLList("url.list4"));
1042 
1043         // list of URL objects
1044         ListAssert.assertEquals(expected, conf.getURLList("url.list6"));
1045 
1046         // list of interpolated values
1047         ListAssert.assertEquals(expected, conf.getURLList("url.list.interpolated"));
1048 
1049         // single URL values
1050         expected = new ArrayList();
1051         expected.add(new URL("http://www.apache.org"));
1052         ListAssert.assertEquals(expected, conf.getURLList("url.string"));
1053         ListAssert.assertEquals(expected, conf.getURLList("url.object"));
1054 
1055         // empty list
1056         ListAssert.assertEquals(new ArrayList(), conf.getURLList("empty"));
1057     }
1058 
1059     public void testGetLocale()
1060     {
1061         // language
1062         conf.setProperty("locale", "fr");
1063         assertEquals("language", new Locale("fr", ""), conf.getLocale("locale"));
1064 
1065         // language + variant
1066         conf.setProperty("locale", "fr__POSIX");
1067         assertEquals("language + variant", new Locale("fr", "", "POSIX"), conf.getLocale("locale"));
1068 
1069         // country
1070         conf.setProperty("locale", "_FR");
1071         assertEquals("country", new Locale("", "FR"), conf.getLocale("locale"));
1072 
1073         // country + variant
1074         conf.setProperty("locale", "_FR_WIN");
1075         assertEquals("country + variant", new Locale("", "FR", "WIN"), conf.getLocale("locale"));
1076 
1077         // language + country
1078         conf.setProperty("locale", "fr_FR");
1079         assertEquals("language + country", new Locale("fr", "FR"), conf.getLocale("locale"));
1080 
1081         // language + country + variant
1082         conf.setProperty("locale", "fr_FR_MAC");
1083         assertEquals("language + country + variant", new Locale("fr", "FR", "MAC"), conf.getLocale("locale"));
1084 
1085         // default value
1086         conf.setProperty("locale", "fr");
1087         assertEquals("Existing key with default value", Locale.FRENCH, conf.getLocale("locale", Locale.GERMAN));
1088         assertEquals("Missing key with default value", Locale.GERMAN, conf.getLocale("localeNotInConfig", Locale.GERMAN));
1089 
1090         // interpolated value
1091         assertEquals(Locale.FRENCH, conf.getLocale("locale.string.interpolated"));
1092     }
1093 
1094     public void testGetLocaleArray() throws Exception
1095     {
1096         // missing list
1097         Locale[] defaultValue = new Locale[] { Locale.GERMAN, Locale.FRENCH };
1098         ArrayAssert.assertEquals(defaultValue, conf.getLocaleArray("locale.list", defaultValue));
1099 
1100         Locale[] expected = new Locale[] { Locale.FRENCH, Locale.GERMAN };
1101 
1102         // list of strings
1103         ArrayAssert.assertEquals(expected, conf.getLocaleArray("locale.list1"));
1104 
1105         // list of strings, comma separated
1106         ArrayAssert.assertEquals(expected, conf.getLocaleArray("locale.list2"));
1107 
1108         // list of Locale objects
1109         ArrayAssert.assertEquals(expected, conf.getLocaleArray("locale.list3"));
1110 
1111         // array of Locale objects
1112         ArrayAssert.assertEquals(expected, conf.getLocaleArray("locale.list4"));
1113 
1114         // list of Locale objects
1115         ArrayAssert.assertEquals(expected, conf.getLocaleArray("locale.list6"));
1116 
1117         // list of interpolated values
1118         ArrayAssert.assertEquals(expected, conf.getLocaleArray("locale.list.interpolated"));
1119 
1120         // single Locale values
1121         ArrayAssert.assertEquals(new Locale[] { Locale.FRENCH }, conf.getLocaleArray("locale.string"));
1122         ArrayAssert.assertEquals(new Locale[] { Locale.FRENCH }, conf.getLocaleArray("locale.object"));
1123 
1124         // empty array
1125         ArrayAssert.assertEquals(new Locale[] { }, conf.getLocaleArray("empty"));
1126     }
1127 
1128     public void testGetLocaleList() throws Exception
1129     {
1130         // missing list
1131         ListAssert.assertEquals(null, conf.getLocaleList("locale.list", null));
1132 
1133         List expected = new ArrayList();
1134         expected.add(Locale.FRENCH);
1135         expected.add(Locale.GERMAN);
1136 
1137         // list of strings
1138         ListAssert.assertEquals(expected, conf.getLocaleList("locale.list1"));
1139 
1140         // list of strings, comma separated
1141         ListAssert.assertEquals(expected, conf.getLocaleList("locale.list2"));
1142 
1143         // list of Locale objects
1144         ListAssert.assertEquals(expected, conf.getLocaleList("locale.list3"));
1145 
1146         // array of Locale objects
1147         ListAssert.assertEquals(expected, conf.getLocaleList("locale.list4"));
1148 
1149         // list of Locale objects
1150         ListAssert.assertEquals(expected, conf.getLocaleList("locale.list6"));
1151 
1152         // list of interpolated values
1153         ListAssert.assertEquals(expected, conf.getLocaleList("locale.list.interpolated"));
1154 
1155         // single Locale values
1156         expected = new ArrayList();
1157         expected.add(Locale.FRENCH);
1158         ListAssert.assertEquals(expected, conf.getLocaleList("locale.string"));
1159         ListAssert.assertEquals(expected, conf.getLocaleList("locale.object"));
1160 
1161         // empty list
1162         ListAssert.assertEquals(new ArrayList(), conf.getLocaleList("empty"));
1163     }
1164 
1165     public void testGetColor()
1166     {
1167         // RRGGBB
1168         conf.setProperty("color", "FF0000");
1169         assertEquals("color", Color.red, conf.getColor("color"));
1170 
1171         // #RRGGBB
1172         conf.setProperty("color", "#00FF00");
1173         assertEquals("color", Color.green, conf.getColor("color"));
1174 
1175         // #RRGGBBAA
1176         conf.setProperty("color", "#01030507");
1177         Color color = conf.getColor("color");
1178         assertNotNull("null color", color);
1179         assertEquals("red",   1, color.getRed());
1180         assertEquals("green", 3, color.getGreen());
1181         assertEquals("blue",  5, color.getBlue());
1182         assertEquals("alpha", 7, color.getAlpha());
1183 
1184         // interpolated value
1185         assertEquals(Color.red, conf.getColor("color.string.interpolated"));
1186     }
1187 
1188     public void testGetColorArray() throws Exception
1189     {
1190         // missing list
1191         Color[] defaultValue = new Color[] { Color.red, Color.blue };
1192         ArrayAssert.assertEquals(defaultValue, conf.getColorArray("color.list", defaultValue));
1193 
1194         Color[] expected = new Color[] { Color.red, Color.blue };
1195 
1196         // list of strings
1197         ArrayAssert.assertEquals(expected, conf.getColorArray("color.list1"));
1198 
1199         // list of strings, comma separated
1200         ArrayAssert.assertEquals(expected, conf.getColorArray("color.list2"));
1201 
1202         // list of Color objects
1203         ArrayAssert.assertEquals(expected, conf.getColorArray("color.list3"));
1204 
1205         // array of Color objects
1206         ArrayAssert.assertEquals(expected, conf.getColorArray("color.list4"));
1207 
1208         // list of Color objects
1209         ArrayAssert.assertEquals(expected, conf.getColorArray("color.list6"));
1210 
1211         // list of interpolated values
1212         ArrayAssert.assertEquals(expected, conf.getColorArray("color.list.interpolated"));
1213 
1214         // single Color values
1215         ArrayAssert.assertEquals(new Color[] { Color.red }, conf.getColorArray("color.string"));
1216         ArrayAssert.assertEquals(new Color[] { Color.red }, conf.getColorArray("color.object"));
1217 
1218         // empty array
1219         ArrayAssert.assertEquals(new Color[] { }, conf.getColorArray("empty"));
1220     }
1221 
1222     public void testGetColorList() throws Exception
1223     {
1224         // missing list
1225         ListAssert.assertEquals(null, conf.getColorList("color.list", null));
1226 
1227         List expected = new ArrayList();
1228         expected.add(Color.red);
1229         expected.add(Color.blue);
1230 
1231         // list of strings
1232         ListAssert.assertEquals(expected, conf.getColorList("color.list1"));
1233 
1234         // list of strings, comma separated
1235         ListAssert.assertEquals(expected, conf.getColorList("color.list2"));
1236 
1237         // list of Color objects
1238         ListAssert.assertEquals(expected, conf.getColorList("color.list3"));
1239 
1240         // array of Color objects
1241         ListAssert.assertEquals(expected, conf.getColorList("color.list4"));
1242 
1243         // list of Color objects
1244         ListAssert.assertEquals(expected, conf.getColorList("color.list6"));
1245 
1246         // list of interpolated values
1247         ListAssert.assertEquals(expected, conf.getColorList("color.list.interpolated"));
1248 
1249         // single Color values
1250         expected = new ArrayList();
1251         expected.add(Color.red);
1252         ListAssert.assertEquals(expected, conf.getColorList("color.string"));
1253         ListAssert.assertEquals(expected, conf.getColorList("color.object"));
1254 
1255         // empty list
1256         ListAssert.assertEquals(new ArrayList(), conf.getColorList("empty"));
1257     }
1258 
1259     public void testGetDate() throws Exception
1260     {
1261         DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
1262 
1263         // missing Date
1264         Date defaultValue = new Date();
1265         assertEquals(defaultValue, conf.getDate("date", defaultValue));
1266 
1267         Date expected = format.parse("2004-01-01");
1268 
1269         // Date string
1270         assertEquals(expected, conf.getDate("date.string"));
1271 
1272         // Date object
1273         assertEquals(expected, conf.getDate("date.object"));
1274 
1275         // Calendar object
1276         assertEquals(expected, conf.getDate("calendar.object"));
1277 
1278         // interpolated value
1279         assertEquals(expected, conf.getDate("date.string.interpolated"));
1280     }
1281 
1282     public void testGetDateArray() throws Exception
1283     {
1284         DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
1285         Date date1 = format.parse("2004-01-01");
1286         Date date2 = format.parse("2004-12-31");
1287 
1288         // missing list
1289         Date[] defaultValue = new Date[] { date2, date1 };
1290         ArrayAssert.assertEquals(defaultValue, conf.getDateArray("date.list", defaultValue));
1291 
1292         Date[] expected = new Date[] { date1, date2 };
1293 
1294         // list of strings
1295         ArrayAssert.assertEquals(expected, conf.getDateArray("date.list1"));
1296 
1297         // list of strings, comma separated
1298         ArrayAssert.assertEquals(expected, conf.getDateArray("date.list2"));
1299 
1300         // list of Date objects
1301         ArrayAssert.assertEquals(expected, conf.getDateArray("date.list3"));
1302 
1303         // array of Date objects
1304         ArrayAssert.assertEquals(expected, conf.getDateArray("date.list4"));
1305 
1306         // list of Calendar objects
1307         ArrayAssert.assertEquals(expected, conf.getDateArray("date.list5"));
1308 
1309         // list of Date objects
1310         ArrayAssert.assertEquals(expected, conf.getDateArray("date.list6"));
1311 
1312         // list of interpolated values
1313         ArrayAssert.assertEquals(expected, conf.getDateArray("date.list.interpolated"));
1314 
1315         // single Date values
1316         ArrayAssert.assertEquals(new Date[] { date1 }, conf.getDateArray("date.string"));
1317         ArrayAssert.assertEquals(new Date[] { date1 }, conf.getDateArray("date.object"));
1318 
1319         // empty array
1320         ArrayAssert.assertEquals(new Date[] { }, conf.getDateArray("empty"));
1321     }
1322 
1323     public void testGetDateList() throws Exception
1324     {
1325         DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
1326         Date date1 = format.parse("2004-01-01");
1327         Date date2 = format.parse("2004-12-31");
1328 
1329         // missing list
1330         ListAssert.assertEquals(null, conf.getDateList("date.list", (List) null));
1331 
1332         List expected = new ArrayList();
1333         expected.add(date1);
1334         expected.add(date2);
1335 
1336         // list of strings
1337         ListAssert.assertEquals(expected, conf.getDateList("date.list1"));
1338 
1339         // list of strings, comma separated
1340         ListAssert.assertEquals(expected, conf.getDateList("date.list2"));
1341 
1342         // list of Date objects
1343         ListAssert.assertEquals(expected, conf.getDateList("date.list3"));
1344 
1345         // array of Date objects
1346         ListAssert.assertEquals(expected, conf.getDateList("date.list4"));
1347 
1348         // list of Calendar objects
1349         ListAssert.assertEquals(expected, conf.getDateList("date.list5"));
1350 
1351         // list of Date objects
1352         ListAssert.assertEquals(expected, conf.getDateList("date.list6"));
1353 
1354         // list of interpolated values
1355         ListAssert.assertEquals(expected, conf.getDateList("date.list.interpolated"));
1356 
1357         // single Date values
1358         expected = new ArrayList();
1359         expected.add(date1);
1360         ListAssert.assertEquals(expected, conf.getDateList("date.string"));
1361         ListAssert.assertEquals(expected, conf.getDateList("date.object"));
1362 
1363         // empty list
1364         ListAssert.assertEquals(new ArrayList(), conf.getDateList("empty"));
1365     }
1366 
1367     public void testGetCalendar() throws Exception
1368     {
1369         DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
1370 
1371         // missing Date
1372         Calendar defaultValue = Calendar.getInstance();
1373         defaultValue.setTime(new Date());
1374         assertEquals(defaultValue, conf.getCalendar("calendar", defaultValue));
1375 
1376         Calendar expected = Calendar.getInstance();
1377         expected.setTime(format.parse("2004-01-01"));
1378 
1379         // Calendar string
1380         assertEquals(expected, conf.getCalendar("calendar.string"));
1381 
1382         // Calendar object
1383         assertEquals(expected, conf.getCalendar("calendar.object"));
1384 
1385         // Date object
1386         assertEquals(expected, conf.getCalendar("date.object"));
1387 
1388         // interpolated value
1389         assertEquals(expected, conf.getCalendar("calendar.string.interpolated"));
1390     }
1391 
1392 
1393     public void testGetCalendarArray() throws Exception
1394     {
1395         DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
1396         Date date1 = format.parse("2004-01-01");
1397         Date date2 = format.parse("2004-12-31");
1398         Calendar calendar1 = Calendar.getInstance();
1399         calendar1.setTime(date1);
1400         Calendar calendar2 = Calendar.getInstance();
1401         calendar2.setTime(date2);
1402 
1403         // missing list
1404         Calendar[] defaultValue = new Calendar[] { calendar2, calendar1 };
1405         ArrayAssert.assertEquals(defaultValue, conf.getCalendarArray("calendar.list", defaultValue));
1406 
1407         Calendar[] expected = new Calendar[] { calendar1, calendar2 };
1408 
1409         // list of strings
1410         ArrayAssert.assertEquals(expected, conf.getCalendarArray("calendar.list1"));
1411 
1412         // list of strings, comma separated
1413         ArrayAssert.assertEquals(expected, conf.getCalendarArray("calendar.list2"));
1414 
1415         // list of Calendar objects
1416         ArrayAssert.assertEquals(expected, conf.getCalendarArray("calendar.list3"));
1417 
1418         // array of Calendar objects
1419         ArrayAssert.assertEquals(expected, conf.getCalendarArray("calendar.list4"));
1420 
1421         // list of Date objects
1422         ArrayAssert.assertEquals(expected, conf.getCalendarArray("calendar.list5"));
1423 
1424         // list of Calendar objects
1425         ArrayAssert.assertEquals(expected, conf.getCalendarArray("calendar.list6"));
1426 
1427         // list of interpolated values
1428         ArrayAssert.assertEquals(expected, conf.getCalendarArray("calendar.list.interpolated"));
1429 
1430         // single Calendar values
1431         ArrayAssert.assertEquals(new Calendar[] { calendar1 }, conf.getCalendarArray("calendar.string"));
1432         ArrayAssert.assertEquals(new Calendar[] { calendar1 }, conf.getCalendarArray("calendar.object"));
1433 
1434         // empty array
1435         ArrayAssert.assertEquals(new Calendar[] { }, conf.getCalendarArray("empty"));
1436     }
1437 
1438     public void testGetCalendarList() throws Exception
1439     {
1440         DateFormat format = new SimpleDateFormat("yyyy-MM-dd");
1441         Date date1 = format.parse("2004-01-01");
1442         Date date2 = format.parse("2004-12-31");
1443         Calendar calendar1 = Calendar.getInstance();
1444         calendar1.setTime(date1);
1445         Calendar calendar2 = Calendar.getInstance();
1446         calendar2.setTime(date2);
1447 
1448         // missing list
1449         ListAssert.assertEquals(null, conf.getCalendarList("calendar.list", (List) null));
1450 
1451         List expected = new ArrayList();
1452         expected.add(calendar1);
1453         expected.add(calendar2);
1454 
1455         // list of strings
1456         ListAssert.assertEquals(expected, conf.getCalendarList("calendar.list1"));
1457 
1458         // list of strings, comma separated
1459         ListAssert.assertEquals(expected, conf.getCalendarList("calendar.list2"));
1460 
1461         // list of Calendar objects
1462         ListAssert.assertEquals(expected, conf.getCalendarList("calendar.list3"));
1463 
1464         // array of Calendar objects
1465         ListAssert.assertEquals(expected, conf.getCalendarList("calendar.list4"));
1466 
1467         // list of Date objects
1468         ListAssert.assertEquals(expected, conf.getCalendarList("calendar.list5"));
1469 
1470         // list of Calendar objects
1471         ListAssert.assertEquals(expected, conf.getCalendarList("calendar.list6"));
1472 
1473         // list of interpolated values
1474         ListAssert.assertEquals(expected, conf.getCalendarList("calendar.list.interpolated"));
1475 
1476         // single Calendar values
1477         expected = new ArrayList();
1478         expected.add(calendar1);
1479         ListAssert.assertEquals(expected, conf.getCalendarList("date.string"));
1480         ListAssert.assertEquals(expected, conf.getCalendarList("date.object"));
1481 
1482         // empty list
1483         ListAssert.assertEquals(new ArrayList(), conf.getCalendarList("empty"));
1484     }
1485 
1486     public void testConversionException()
1487     {
1488         conf.addProperty("key1", new Object());
1489         conf.addProperty("key2", "xxxxxx");
1490 
1491         try
1492         {
1493             conf.getBooleanArray("key1");
1494             fail("getBooleanArray didn't throw a ConversionException");
1495         }
1496         catch (ConversionException e)
1497         {
1498             // expected
1499         }
1500 
1501         try
1502         {
1503             conf.getBooleanArray("key2");
1504             fail("getBooleanArray didn't throw a ConversionException");
1505         }
1506         catch (ConversionException e)
1507         {
1508             // expected
1509         }
1510 
1511         try
1512         {
1513             conf.getBooleanList("key1");
1514             fail("getBooleanList didn't throw a ConversionException");
1515         }
1516         catch (ConversionException e)
1517         {
1518             // expected
1519         }
1520 
1521         try
1522         {
1523             conf.getBooleanList("key2");
1524             fail("getBooleanList didn't throw a ConversionException");
1525         }
1526         catch (ConversionException e)
1527         {
1528             // expected
1529         }
1530 
1531         try
1532         {
1533             conf.getByteArray("key1");
1534             fail("getByteArray didn't throw a ConversionException");
1535         }
1536         catch (ConversionException e)
1537         {
1538             // expected
1539         }
1540 
1541         try
1542         {
1543             conf.getByteArray("key2");
1544             fail("getByteArray didn't throw a ConversionException");
1545         }
1546         catch (ConversionException e)
1547         {
1548             // expected
1549         }
1550 
1551         try
1552         {
1553             conf.getByteList("key1");
1554             fail("getByteList didn't throw a ConversionException");
1555         }
1556         catch (ConversionException e)
1557         {
1558             // expected
1559         }
1560 
1561         try
1562         {
1563             conf.getByteList("key2");
1564             fail("getByteList didn't throw a ConversionException");
1565         }
1566         catch (ConversionException e)
1567         {
1568             // expected
1569         }
1570 
1571         try
1572         {
1573             conf.getShortArray("key1");
1574             fail("getShortArray didn't throw a ConversionException");
1575         }
1576         catch (ConversionException e)
1577         {
1578             // expected
1579         }
1580 
1581         try
1582         {
1583             conf.getShortArray("key2");
1584             fail("getShortArray didn't throw a ConversionException");
1585         }
1586         catch (ConversionException e)
1587         {
1588             // expected
1589         }
1590 
1591         try
1592         {
1593             conf.getShortList("key1");
1594             fail("getShortList didn't throw a ConversionException");
1595         }
1596         catch (ConversionException e)
1597         {
1598             // expected
1599         }
1600 
1601         try
1602         {
1603             conf.getShortList("key2");
1604             fail("getShortList didn't throw a ConversionException");
1605         }
1606         catch (ConversionException e)
1607         {
1608             // expected
1609         }
1610 
1611         try
1612         {
1613             conf.getIntArray("key1");
1614             fail("getIntArray didn't throw a ConversionException");
1615         }
1616         catch (ConversionException e)
1617         {
1618             // expected
1619         }
1620 
1621         try
1622         {
1623             conf.getIntArray("key2");
1624             fail("getIntArray didn't throw a ConversionException");
1625         }
1626         catch (ConversionException e)
1627         {
1628             // expected
1629         }
1630 
1631         try
1632         {
1633             conf.getIntegerList("key1");
1634             fail("getIntegerList didn't throw a ConversionException");
1635         }
1636         catch (ConversionException e)
1637         {
1638             // expected
1639         }
1640 
1641         try
1642         {
1643             conf.getIntegerList("key2");
1644             fail("getIntegerList didn't throw a ConversionException");
1645         }
1646         catch (ConversionException e)
1647         {
1648             // expected
1649         }
1650 
1651         try
1652         {
1653             conf.getLongArray("key1");
1654             fail("getLongArray didn't throw a ConversionException");
1655         }
1656         catch (ConversionException e)
1657         {
1658             // expected
1659         }
1660 
1661         try
1662         {
1663             conf.getLongArray("key2");
1664             fail("getLongArray didn't throw a ConversionException");
1665         }
1666         catch (ConversionException e)
1667         {
1668             // expected
1669         }
1670 
1671         try
1672         {
1673             conf.getLongList("key1");
1674             fail("getLongList didn't throw a ConversionException");
1675         }
1676         catch (ConversionException e)
1677         {
1678             // expected
1679         }
1680 
1681         try
1682         {
1683             conf.getLongList("key2");
1684             fail("getLongList didn't throw a ConversionException");
1685         }
1686         catch (ConversionException e)
1687         {
1688             // expected
1689         }
1690 
1691         try
1692         {
1693             conf.getFloatArray("key1");
1694             fail("getFloatArray didn't throw a ConversionException");
1695         }
1696         catch (ConversionException e)
1697         {
1698             // expected
1699         }
1700 
1701         try
1702         {
1703             conf.getFloatArray("key2");
1704             fail("getFloatArray didn't throw a ConversionException");
1705         }
1706         catch (ConversionException e)
1707         {
1708             // expected
1709         }
1710 
1711         try
1712         {
1713             conf.getFloatList("key1");
1714             fail("getFloatList didn't throw a ConversionException");
1715         }
1716         catch (ConversionException e)
1717         {
1718             // expected
1719         }
1720 
1721         try
1722         {
1723             conf.getFloatList("key2");
1724             fail("getFloatList didn't throw a ConversionException");
1725         }
1726         catch (ConversionException e)
1727         {
1728             // expected
1729         }
1730 
1731         try
1732         {
1733             conf.getDoubleArray("key1");
1734             fail("getDoubleArray didn't throw a ConversionException");
1735         }
1736         catch (ConversionException e)
1737         {
1738             // expected
1739         }
1740 
1741         try
1742         {
1743             conf.getDoubleArray("key2");
1744             fail("getDoubleArray didn't throw a ConversionException");
1745         }
1746         catch (ConversionException e)
1747         {
1748             // expected
1749         }
1750 
1751         try
1752         {
1753             conf.getDoubleList("key1");
1754             fail("getDoubleList didn't throw a ConversionException");
1755         }
1756         catch (ConversionException e)
1757         {
1758             // expected
1759         }
1760 
1761         try
1762         {
1763             conf.getDoubleList("key2");
1764             fail("getDoubleList didn't throw a ConversionException");
1765         }
1766         catch (ConversionException e)
1767         {
1768             // expected
1769         }
1770 
1771         try
1772         {
1773             conf.getBigIntegerArray("key1");
1774             fail("getBigIntegerArray didn't throw a ConversionException");
1775         }
1776         catch (ConversionException e)
1777         {
1778             // expected
1779         }
1780 
1781         try
1782         {
1783             conf.getBigIntegerArray("key2");
1784             fail("getBigIntegerArray didn't throw a ConversionException");
1785         }
1786         catch (ConversionException e)
1787         {
1788             // expected
1789         }
1790 
1791         try
1792         {
1793             conf.getBigIntegerList("key1");
1794             fail("getBigIntegerList didn't throw a ConversionException");
1795         }
1796         catch (ConversionException e)
1797         {
1798             // expected
1799         }
1800 
1801         try
1802         {
1803             conf.getBigIntegerList("key2");
1804             fail("getBigIntegerList didn't throw a ConversionException");
1805         }
1806         catch (ConversionException e)
1807         {
1808             // expected
1809         }
1810 
1811         try
1812         {
1813             conf.getBigDecimalArray("key1");
1814             fail("getBigDecimalArray didn't throw a ConversionException");
1815         }
1816         catch (ConversionException e)
1817         {
1818             // expected
1819         }
1820 
1821         try
1822         {
1823             conf.getBigDecimalArray("key2");
1824             fail("getBigDecimalArray didn't throw a ConversionException");
1825         }
1826         catch (ConversionException e)
1827         {
1828             // expected
1829         }
1830 
1831         try
1832         {
1833             conf.getBigDecimalList("key1");
1834             fail("getBigDecimalList didn't throw a ConversionException");
1835         }
1836         catch (ConversionException e)
1837         {
1838             // expected
1839         }
1840 
1841         try
1842         {
1843             conf.getBigDecimalList("key2");
1844             fail("getBigDecimalList didn't throw a ConversionException");
1845         }
1846         catch (ConversionException e)
1847         {
1848             // expected
1849         }
1850 
1851         try
1852         {
1853             conf.getURLArray("key1");
1854             fail("getURLArray didn't throw a ConversionException");
1855         }
1856         catch (ConversionException e)
1857         {
1858             // expected
1859         }
1860 
1861         try
1862         {
1863             conf.getURLArray("key2");
1864             fail("getURLArray didn't throw a ConversionException");
1865         }
1866         catch (ConversionException e)
1867         {
1868             // expected
1869         }
1870 
1871         try
1872         {
1873             conf.getURLList("key1");
1874             fail("getURLList didn't throw a ConversionException");
1875         }
1876         catch (ConversionException e)
1877         {
1878             // expected
1879         }
1880 
1881         try
1882         {
1883             conf.getURLList("key2");
1884             fail("getURLList didn't throw a ConversionException");
1885         }
1886         catch (ConversionException e)
1887         {
1888             // expected
1889         }
1890 
1891         try
1892         {
1893             conf.getLocaleArray("key1");
1894             fail("getLocaleArray didn't throw a ConversionException");
1895         }
1896         catch (ConversionException e)
1897         {
1898             // expected
1899         }
1900 
1901         try
1902         {
1903             conf.getLocaleArray("key2");
1904             fail("getLocaleArray didn't throw a ConversionException");
1905         }
1906         catch (ConversionException e)
1907         {
1908             // expected
1909         }
1910 
1911         try
1912         {
1913             conf.getLocaleList("key1");
1914             fail("getLocaleList didn't throw a ConversionException");
1915         }
1916         catch (ConversionException e)
1917         {
1918             // expected
1919         }
1920 
1921         try
1922         {
1923             conf.getLocaleList("key2");
1924             fail("getLocaleList didn't throw a ConversionException");
1925         }
1926         catch (ConversionException e)
1927         {
1928             // expected
1929         }
1930 
1931         try
1932         {
1933             conf.getColorArray("key1");
1934             fail("getColorArray didn't throw a ConversionException");
1935         }
1936         catch (ConversionException e)
1937         {
1938             // expected
1939         }
1940 
1941         try
1942         {
1943             conf.getColorArray("key2");
1944             fail("getColorArray didn't throw a ConversionException");
1945         }
1946         catch (ConversionException e)
1947         {
1948             // expected
1949         }
1950 
1951         try
1952         {
1953             conf.getColorList("key1");
1954             fail("getColorList didn't throw a ConversionException");
1955         }
1956         catch (ConversionException e)
1957         {
1958             // expected
1959         }
1960 
1961         try
1962         {
1963             conf.getColorList("key2");
1964             fail("getColorList didn't throw a ConversionException");
1965         }
1966         catch (ConversionException e)
1967         {
1968             // expected
1969         }
1970 
1971         try
1972         {
1973             conf.getDateArray("key1");
1974             fail("getDateArray didn't throw a ConversionException");
1975         }
1976         catch (ConversionException e)
1977         {
1978             // expected
1979         }
1980 
1981         try
1982         {
1983             conf.getDateArray("key2");
1984             fail("getDateArray didn't throw a ConversionException");
1985         }
1986         catch (ConversionException e)
1987         {
1988             // expected
1989         }
1990 
1991         try
1992         {
1993             conf.getDateList("key1");
1994             fail("getDateList didn't throw a ConversionException");
1995         }
1996         catch (ConversionException e)
1997         {
1998             // expected
1999         }
2000 
2001         try
2002         {
2003             conf.getDateList("key2");
2004             fail("getDateList didn't throw a ConversionException");
2005         }
2006         catch (ConversionException e)
2007         {
2008             // expected
2009         }
2010 
2011         try
2012         {
2013             conf.getCalendarArray("key1");
2014             fail("getCalendarArray didn't throw a ConversionException");
2015         }
2016         catch (ConversionException e)
2017         {
2018             // expected
2019         }
2020 
2021         try
2022         {
2023             conf.getCalendarArray("key2");
2024             fail("getCalendarArray didn't throw a ConversionException");
2025         }
2026         catch (ConversionException e)
2027         {
2028             // expected
2029         }
2030 
2031         try
2032         {
2033             conf.getCalendarList("key1");
2034             fail("getCalendarList didn't throw a ConversionException");
2035         }
2036         catch (ConversionException e)
2037         {
2038             // expected
2039         }
2040 
2041         try
2042         {
2043             conf.getCalendarList("key2");
2044             fail("getCalendarList didn't throw a ConversionException");
2045         }
2046         catch (ConversionException e)
2047         {
2048             // expected
2049         }
2050     }
2051 }