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