* Test double conversions.
*/
@Test
public void doubleConversions()
{
DoubleConverter converter = new DoubleConverter();
assertEquals("7.1", converter.convertToString(7.1, Locale.US));
assertEquals("7,1", converter.convertToString(7.1, DUTCH_LOCALE));
assertNull(converter.convertToObject("", Locale.US));
assertEquals(1.1, converter.convertToObject("1.1", Locale.US), 0.001);
assertEquals("1.1", converter.convertToString(1.1, Locale.US));
try
{
converter.convertToObject("whatever", Locale.US);
fail("Conversion should have thrown an exception");
}
catch (ConversionException e)
{
// this is correct
}
try
{
converter.convertToObject("1.1whatever", Locale.US);
fail("Conversion should have thrown an exception");
}
catch (ConversionException e)
{
// this is correct