01: /*
02: * FirstWordFormatterTest.java
03: *
04: * Copyright (C) 2005 Anupam Sengupta (anupamsg@users.sourceforge.net)
05: *
06: * This program is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU General Public License
08: * as published by the Free Software Foundation; either version 2
09: * 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 extends TestCase {
33:
34: /**
35: * Constructor for AllUpperCaseFormatterTest.
36: *
37: * @param name
38: * name of the test.
39: */
40: public AllUpperCaseFormatterTest(final String name) {
41: super (name);
42:
43: }
44:
45: /**
46: * Main method to perform the tests.
47: *
48: * @param args
49: * Program arguments
50: */
51: public static void main(final String[] args) {
52: junit.textui.TestRunner.run(AllUpperCaseFormatterTest.class);
53: }
54:
55: /**
56: * Test method for 'net.sf.anupam.csv.AllUpperCaseFormatter.format(String)'.
57: */
58: public void testFormat() {
59: final String name = "Anupam B Sengupta";
60: final CSVFieldFormatter formatter = new AllUpperCaseFormatter();
61: assertNotNull(formatter);
62: final String result = formatter.format(name);
63: assertEquals("ANUPAM B SENGUPTA", result);
64: }
65:
66: /**
67: * Test method for 'net.sf.anupam.csv.AllUpperCaseFormatter.format(String)'.
68: */
69: public void testFormatWhenNull() {
70: final CSVFieldFormatter formatter = new AllUpperCaseFormatter();
71: assertNotNull(formatter);
72:
73: final String nullResult = formatter.format(null);
74: assertNull(nullResult);
75:
76: }
77:
78: /**
79: * Test method for 'net.sf.anupam.csv.AllUpperCaseFormatter.format(String)'.
80: */
81: public void testFormatWhenEmpty() {
82: final CSVFieldFormatter formatter = new AllUpperCaseFormatter();
83: assertNotNull(formatter);
84:
85: final String emptyResult = formatter.format("");
86: assertEquals("", emptyResult);
87:
88: }
89: }
|