/**
* Test long conversions.
*/
public void testLongConversions()
{
LongConverter converter = new LongConverter();
assertNull(converter.convertToObject("", Locale.US));
assertEquals(new Long(10), converter.convertToObject("10", Locale.US));
assertEquals("10", converter.convertToString((long)10, Locale.US));
try
{
converter.convertToObject("whatever", Locale.US);
fail("Conversion should have thrown an exception");
}
catch (ConversionException e)
{
// This is correct
}
try
{
converter.convertToObject("10whatever", Locale.US);
fail("Conversion should have thrown an exception");
}
catch (ConversionException e)
{
// This is correct
}
try
{
converter.convertToObject("" + Long.MAX_VALUE + "0", Locale.US);
fail("Conversion should have thrown an exception");
}
catch (ConversionException e)
{
// This is correct