KickJava   Java API By Example, From Geeks To Geeks.

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


1 /*
2  * FirstWordFormatterTest.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.1 $
21  */

22 package net.sf.anupam.csv.formatters;
23
24 import junit.framework.TestCase;
25
26 /**
27  * AllUpperCaseFormatterTest.
28  *
29  * @author Anupam Sengupta
30  * @version $Revision: 1.1 $
31  */

32 public class AllUpperCaseFormatterTest
33         extends TestCase {
34
35     /**
36      * Constructor for AllUpperCaseFormatterTest.
37      *
38      * @param name
39      * name of the test.
40      */

41     public AllUpperCaseFormatterTest(final String JavaDoc name) {
42         super(name);
43
44     }
45
46     /**
47      * Main method to perform the tests.
48      *
49      * @param args
50      * Program arguments
51      */

52     public static void main(final String JavaDoc [] args) {
53         junit.textui.TestRunner.run(AllUpperCaseFormatterTest.class);
54     }
55
56     /**
57      * Test method for 'net.sf.anupam.csv.AllUpperCaseFormatter.format(String)'.
58      */

59     public void testFormat() {
60         final String JavaDoc name = "Anupam B Sengupta";
61         final CSVFieldFormatter formatter = new AllUpperCaseFormatter();
62         assertNotNull(formatter);
63         final String JavaDoc result = formatter.format(name);
64         assertEquals("ANUPAM B SENGUPTA", result);
65     }
66
67     /**
68      * Test method for 'net.sf.anupam.csv.AllUpperCaseFormatter.format(String)'.
69      */

70     public void testFormatWhenNull() {
71         final CSVFieldFormatter formatter = new AllUpperCaseFormatter();
72         assertNotNull(formatter);
73
74         final String JavaDoc nullResult = formatter.format(null);
75         assertNull(nullResult);
76
77     }
78
79     /**
80      * Test method for 'net.sf.anupam.csv.AllUpperCaseFormatter.format(String)'.
81      */

82     public void testFormatWhenEmpty() {
83         final CSVFieldFormatter formatter = new AllUpperCaseFormatter();
84         assertNotNull(formatter);
85
86         final String JavaDoc emptyResult = formatter.format("");
87         assertEquals("", emptyResult);
88
89     }
90 }
91
Popular Tags