Package org.apache.wicket.util.convert.converter

Examples of org.apache.wicket.util.convert.converter.DoubleConverter


  public void thousandSeperator() throws Exception
  {
    BigDecimalConverter bdc = new BigDecimalConverter();
    assertEquals(new BigDecimal(3000), bdc.convertToObject("3 000", Locale.FRENCH));

    DoubleConverter dc = new DoubleConverter();
    assertEquals(3000, dc.convertToObject("3 000", Locale.FRENCH), 0.001);

  }
View Full Code Here


   * 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
View Full Code Here

        numberFormat.setMaximumFractionDigits(15);
        return numberFormat;
      }
    };
    BigDecimal value = new BigDecimal("1234567890.987654321");*/
    IConverter<Double> converter = new DoubleConverter();
    Double value = 1234567890.987654321d;
    System.err.println("res: " + converter.convertToString(value, Locale.ENGLISH));
  }
View Full Code Here

TOP

Related Classes of org.apache.wicket.util.convert.converter.DoubleConverter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.