KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > anupam > csv > formatters > CSVFormatterConfigParserTest


1 /*
2  * CSVFormatterConfigParserTest.java
3  *
4  * Copyright (C) 2005 Anupam Sengupta (anupamsg@users.sourceforge.net)
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU General Public License
8  * as published by the Free Software Foundation; either version 2
9  * of the License, or (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  *
20  * Version: $Revision: 1.2 $
21  */

22 package net.sf.anupam.csv.formatters;
23
24 import junit.framework.TestCase;
25 import org.apache.commons.logging.Log;
26 import org.apache.commons.logging.LogFactory;
27
28 import java.util.Map JavaDoc;
29
30 /**
31  * CSVFormatterConfigParserTest.
32  *
33  * @author Anupam Sengupta
34  * @version $Revision: 1.2 $
35  */

36 public class CSVFormatterConfigParserTest
37         extends TestCase {
38
39     /**
40      * The logger to use.
41      */

42     private static final Log LOG = LogFactory
43             .getLog(CSVFormatterConfigParserTest.class);
44
45     /**
46      * Constructor for CSVFormatterConfigParserTest.
47      *
48      * @param name name of the test
49      */

50     public CSVFormatterConfigParserTest(final String JavaDoc name) {
51         super(name);
52     }
53
54     /**
55      * Main method to run the test.
56      *
57      * @param args program arguments
58      */

59     public static void main(final String JavaDoc [] args) {
60         junit.textui.TestRunner.run(CSVFormatterConfigParserTest.class);
61     }
62
63     /**
64      * Test method for
65      * 'net.sf.anupam.csv.formatters.CSVFormatterConfigParser.getFormatMappings(String,
66      * boolean)'.
67      */

68     public void testGetFormatMappings() {
69         final CSVFormatterConfigParser parser = CSVFormatterConfigParser.getConfigParser();
70         assertNotNull(parser);
71
72         final Map JavaDoc<String JavaDoc, FormatterConfiguration> formatterMap = parser
73                 .getFormatMappings(
74                         "net/sf/anupam/csv/formatters/csv-formatter-config.xml",
75                         true);
76         assertNotNull("Formatter Map Should not be Null", formatterMap);
77         assertFalse("Formatter Map should not be Empty", formatterMap.isEmpty());
78
79         for (String JavaDoc formatterName : formatterMap.keySet()) {
80             final FormatterConfiguration formatterConfig = formatterMap
81                     .get(formatterName);
82             assertNotNull(formatterConfig);
83             LOG.info(formatterConfig);
84         }
85
86     }
87
88 }
89
Popular Tags