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

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


   * Test integer conversions.
   */
  @Test
  public void integerConversions()
  {
    IntegerConverter converter = new IntegerConverter();
    assertEquals("7", converter.convertToString(7, Locale.US));
    assertNull(converter.convertToObject("", Locale.US));
    assertEquals(new Integer(10), converter.convertToObject("10", Locale.US));
    assertEquals("10", converter.convertToString(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)Integer.MAX_VALUE + 1), Locale.US);
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // This is correct
View Full Code Here


  /**
   * Test integer conversions.
   */
  public void testIntegerConversions()
  {
    IntegerConverter converter = new IntegerConverter();
    assertEquals(new Integer(10), converter.convertToObject("10", Locale.US));
    assertEquals("10", converter.convertToString(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)Integer.MAX_VALUE + 1), Locale.US);
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // This is correct
View Full Code Here

  /**
   * Test integer conversions.
   */
  public void testIntegerConversions()
  {
    IntegerConverter converter = new IntegerConverter();
    assertEquals("7", converter.convertToString(7, Locale.US));
    assertNull(converter.convertToObject("", Locale.US));
    assertEquals(new Integer(10), converter.convertToObject("10", Locale.US));
    assertEquals("10", converter.convertToString(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)Integer.MAX_VALUE + 1), Locale.US);
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // This is correct
View Full Code Here

  /**
   * Test integer conversions.
   */
  public void testIntegerConversions()
  {
    IntegerConverter converter = new IntegerConverter();
    assertEquals(new Integer(10), converter.convertToObject("10", Locale.US));
    assertEquals("10", converter.convertToString(new Integer(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)Integer.MAX_VALUE + 1), Locale.US);
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // This is correct
View Full Code Here

  /**
   * Test integer conversions.
   */
  public void testIntegerConversions()
  {
    IntegerConverter converter = new IntegerConverter();
    assertEquals(new Integer(10), converter.convertToObject("10", Locale.US));
    assertEquals("10", converter.convertToString(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)Integer.MAX_VALUE + 1), Locale.US);
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // This is correct
View Full Code Here

   * Test integer conversions.
   */
  @Test
  public void integerConversions()
  {
    IntegerConverter converter = new IntegerConverter();
    assertEquals("7", converter.convertToString(7, Locale.US));
    assertNull(converter.convertToObject("", Locale.US));
    assertEquals(new Integer(10), converter.convertToObject("10", Locale.US));
    assertEquals("10", converter.convertToString(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)Integer.MAX_VALUE + 1), Locale.US);
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // This is correct
View Full Code Here

    private static final long serialVersionUID = 7243035341677925260L;

    private final HashMap<Class<?>, AbstractConverter> converters = new HashMap<Class<?>, AbstractConverter>();

    public ValueConverter() {
        converters.put(Integer.class, new IntegerConverter());
        converters.put(Long.class, new LongConverter());
    }
View Full Code Here

TOP

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

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.