StrutsTypeConverterTestpublic class StrutsTypeConverterTest extends TestCase Test case for Struts Type Converter. |
Methods Summary |
---|
public void | testConvertFromString()Typically form html -> Struts
InternalStrutsTypeConverter strutsTypeConverter = new InternalStrutsTypeConverter();
strutsTypeConverter.convertValue(new HashMap(), "12/12/1997", Date.class);
assertTrue(strutsTypeConverter.isConvertFromString);
assertTrue(strutsTypeConverter.objToBeConverted instanceof String[]);
assertEquals(((String[])strutsTypeConverter.objToBeConverted).length, 1);
| public void | testConvertFromStringInArrayForm()Typically from html -> Struts (in array due to the nature of html, param
being able to have many values).
InternalStrutsTypeConverter strutsTypeConverter = new InternalStrutsTypeConverter();
strutsTypeConverter.convertValue(new HashMap(), new String[] { "12/12/1997", "1/1/1977" }, Date.class);
assertTrue(strutsTypeConverter.isConvertFromString);
assertTrue(strutsTypeConverter.objToBeConverted instanceof String[]);
assertEquals(((String[])strutsTypeConverter.objToBeConverted).length, 2);
| public void | testConvertToString()Typically form Struts -> html
InternalStrutsTypeConverter strutsTypeConverter = new InternalStrutsTypeConverter();
strutsTypeConverter.convertValue(new HashMap(), "", String.class);
assertTrue(strutsTypeConverter.isConvertToString);
assertEquals(strutsTypeConverter.objToBeConverted, "");
| public void | testFallbackConversion()
InternalStrutsTypeConverter strutsTypeConverter = new InternalStrutsTypeConverter();
strutsTypeConverter.convertValue(new HashMap(), new Object(), Date.class);
assertTrue(strutsTypeConverter.fallbackConversion);
|
|