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  package org.apache.commons.beanutils.converters;
18  
19  import java.util.Calendar;
20  import junit.framework.TestSuite;
21  
22  /***
23   * Test Case for the CalendarConverter class.
24   *
25   * @version $Revision: 471352 $
26   */
27  public class CalendarConverterTestCase extends DateConverterTestBase {
28  
29      /***
30       * Construct a new Calendar test case.
31       * @param name Test Name
32       */
33      public CalendarConverterTestCase(String name) {
34          super(name);
35      }
36  
37      // ------------------------------------------------------------------------
38  
39      /***
40       * Create Test Suite
41       * @return test suite
42       */
43      public static TestSuite suite() {
44          return new TestSuite(CalendarConverterTestCase.class);        
45      }
46  
47      // ------------------------------------------------------------------------
48      /***
49       * Create the Converter with no default value.
50       * @return A new Converter
51       */
52      protected DateTimeConverter makeConverter() {
53          return new CalendarConverter();
54      }
55      
56      /***
57       * Create the Converter with a default value.
58       * @param defaultValue The default value
59       * @return A new Converter
60       */
61      protected DateTimeConverter makeConverter(Object defaultValue) {
62          return new CalendarConverter(defaultValue);
63      }
64  
65      /***
66       * Return the expected type
67       * @return The expected type
68       */
69      protected Class getExpectedType() {
70          return Calendar.class;
71      }
72  
73      /***
74       * Convert from a java.util.Date to the Converter's type.
75       * 
76       * @param value The Date value to convert
77       * @return The converted value
78       */
79      protected Object toType(Calendar value) {
80          return value;
81     }
82  
83  }