1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.commons.beanutils.converters;
18
19 import java.util.Calendar;
20 import java.util.Date;
21
22 import junit.framework.TestSuite;
23
24 /***
25 * Test Case for the DateConverter class.
26 *
27 * @version $Revision: 471352 $
28 */
29 public class DateConverterTestCase extends DateConverterTestBase {
30
31 /***
32 * Construct a new Date test case.
33 * @param name Test Name
34 */
35 public DateConverterTestCase(String name) {
36 super(name);
37 }
38
39
40
41 /***
42 * Create Test Suite
43 * @return test suite
44 */
45 public static TestSuite suite() {
46 return new TestSuite(DateConverterTestCase.class);
47 }
48
49 /*** Set Up */
50 public void setUp() throws Exception {
51 }
52
53 /*** Tear Down */
54 public void tearDown() throws Exception {
55 }
56
57
58
59 /***
60 * Create the Converter with no default value.
61 * @return A new Converter
62 */
63 protected DateTimeConverter makeConverter() {
64 return new DateConverter();
65 }
66
67 /***
68 * Create the Converter with a default value.
69 * @param defaultValue The default value
70 * @return A new Converter
71 */
72 protected DateTimeConverter makeConverter(Object defaultValue) {
73 return new DateConverter(defaultValue);
74 }
75
76 /***
77 * Return the expected type
78 * @return The expected type
79 */
80 protected Class getExpectedType() {
81 return Date.class;
82 }
83
84 /***
85 * Convert from a Calendar to the appropriate Date type
86 *
87 * @param value The Calendar value to convert
88 * @return The converted value
89 */
90 protected Object toType(Calendar value) {
91 return value.getTime();
92 }
93 }