| org.apache.commons.beanutils.converters.DateConverterTestBase
All known Subclasses: org.apache.commons.beanutils.converters.SqlDateConverterTestCase, org.apache.commons.beanutils.converters.DateConverterTestCase, org.apache.commons.beanutils.converters.SqlTimestampConverterTestCase, org.apache.commons.beanutils.converters.CalendarConverterTestCase, org.apache.commons.beanutils.converters.SqlTimeConverterTestCase,
DateConverterTestBase | abstract public class DateConverterTestBase extends TestCase (Code) | | Abstract base for <Date>Converter classes.
version: $Revision: 471689 $ $Date: 2006-11-06 10:52:49 +0000 (Mon, 06 Nov 2006) $ |
Method Summary | |
abstract protected Class | getExpectedType() | long | getTimeInMillis(Object date) | void | invalidConversion(Converter converter, Object value) | abstract protected DateTimeConverter | makeConverter() Create the Converter with no default value. | abstract protected DateTimeConverter | makeConverter(Object defaultValue) Create the Converter with a default value. | void | stringConversion(Converter converter, String expected, Object value) | public void | testConvertDate() Assumes convert() returns some non-null
instance of getExpectedType(). | public void | testConvertNull() Assumes ConversionException in response to covert(getExpectedType(), null). | public void | testDefaultStringToTypeConvert() Test default String to type conversion
N.B. | public void | testDefaultType() Test Default Type conversion (i.e. | public void | testInvalidType() | public void | testLocale() | public void | testMultiplePatterns() | public void | testPatternDefault() | public void | testPatternNoDefault() | public void | testPatternNullDefault() | public void | testStringConversion() | Calendar | toCalendar(String value, String pattern, Locale locale) | Date | toDate(Calendar calendar) | java.sql.Date | toSqlDate(Calendar calendar) | java.sql.Time | toSqlTime(Calendar calendar) | java.sql.Timestamp | toSqlTimestamp(Calendar calendar) | abstract protected Object | toType(Calendar value) | Object | toType(String value, String pattern, Locale locale) | void | validConversion(Converter converter, Object expected, Object value) |
DateConverterTestBase | public DateConverterTestBase(String name)(Code) | | Construtc a new test case.
Parameters: name - Name of the test |
getExpectedType | abstract protected Class getExpectedType()(Code) | | Return the expected type
The expected type |
getTimeInMillis | long getTimeInMillis(Object date)(Code) | | Convert a Date or Calendar objects to the time in millisconds
Parameters: date - The date or calendar object The time in milliseconds |
invalidConversion | void invalidConversion(Converter converter, Object value)(Code) | | Test Conversion Error
Parameters: converter - The converter to use Parameters: value - The value to convert |
makeConverter | abstract protected DateTimeConverter makeConverter()(Code) | | Create the Converter with no default value.
A new Converter |
makeConverter | abstract protected DateTimeConverter makeConverter(Object defaultValue)(Code) | | Create the Converter with a default value.
Parameters: defaultValue - The default value A new Converter |
stringConversion | void stringConversion(Converter converter, String expected, Object value)(Code) | | Test Conversion to String
Parameters: converter - The converter to use Parameters: expected - The expected result Parameters: value - The value to convert |
testConvertDate | public void testConvertDate()(Code) | | Assumes convert() returns some non-null
instance of getExpectedType().
|
testConvertNull | public void testConvertNull()(Code) | | Assumes ConversionException in response to covert(getExpectedType(), null).
|
testDefaultStringToTypeConvert | public void testDefaultStringToTypeConvert()(Code) | | Test default String to type conversion
N.B. This method is overriden by test case
implementations for java.sql.Date/Time/Timestamp
|
testDefaultType | public void testDefaultType()(Code) | | Test Default Type conversion (i.e. don't specify target type)
|
testInvalidType | public void testInvalidType()(Code) | | Test Converter with types it can't handle
|
testLocale | public void testLocale()(Code) | | Test Date Converter with no default value
|
testMultiplePatterns | public void testMultiplePatterns()(Code) | | Test Converter with multiple patterns
|
testPatternDefault | public void testPatternDefault()(Code) | | Test Converter with no default value
|
testPatternNoDefault | public void testPatternNoDefault()(Code) | | Test Converter with no default value
|
testPatternNullDefault | public void testPatternNullDefault()(Code) | | Test Converter with no default value
|
testStringConversion | public void testStringConversion()(Code) | | Test Conversion to String
|
toCalendar | Calendar toCalendar(String value, String pattern, Locale locale)(Code) | | Parse a String value to a Calendar
Parameters: value - The String value to parse Parameters: pattern - The date pattern Parameters: locale - The locale to use (or null) parsed Calendar value |
toDate | Date toDate(Calendar calendar)(Code) | | Convert a Calendar to a java.util.Date
Parameters: calendar - The calendar object to convert The converted java.util.Date |
toSqlDate | java.sql.Date toSqlDate(Calendar calendar)(Code) | | Convert a Calendar to a java.sql.Date
Parameters: calendar - The calendar object to convert The converted java.sql.Date |
toSqlTime | java.sql.Time toSqlTime(Calendar calendar)(Code) | | Convert a Calendar to a java.sql.Time
Parameters: calendar - The calendar object to convert The converted java.sql.Time |
toSqlTimestamp | java.sql.Timestamp toSqlTimestamp(Calendar calendar)(Code) | | Convert a Calendar to a java.sql.Timestamp
Parameters: calendar - The calendar object to convert The converted java.sql.Timestamp |
toType | abstract protected Object toType(Calendar value)(Code) | | Convert from a Calendar to the appropriate Date type
Parameters: value - The Calendar value to convert The converted value |
toType | Object toType(String value, String pattern, Locale locale)(Code) | | Parse a String value to the required type
Parameters: value - The String value to parse Parameters: pattern - The date pattern Parameters: locale - The locale to use (or null) parsed Calendar value |
validConversion | void validConversion(Converter converter, Object expected, Object value)(Code) | | Test Conversion to the required type
Parameters: converter - The converter to use Parameters: expected - The expected result Parameters: value - The value to convert |
|
|