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

Examples of org.apache.wicket.util.convert.converter.CalendarConverter.convertToObject()


    assertEquals("5/1/11", converter.convertToString(cal, Locale.US));
    assertEquals(cal, converter.convertToObject("5/1/11", Locale.US));

    try
    {
      converter.convertToObject("whatever", Locale.US);
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // this is correct
View Full Code Here


    {
      // this is correct
    }
    try
    {
      converter.convertToObject("5/1/11whatever", Locale.US);
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // this is correct
View Full Code Here

    Calendar cal = Calendar.getInstance(DUTCH_LOCALE);
    cal.clear();
    cal.set(2011, Calendar.MAY, 1);

    assertEquals("1-5-11", converter.convertToString(cal, DUTCH_LOCALE));
    assertEquals(cal, converter.convertToObject("1-5-11", DUTCH_LOCALE));

    cal = Calendar.getInstance(Locale.US);
    cal.clear();
    cal.set(2011, Calendar.MAY, 1);
    assertEquals("5/1/11", converter.convertToString(cal, Locale.US));
View Full Code Here

    cal = Calendar.getInstance(Locale.US);
    cal.clear();
    cal.set(2011, Calendar.MAY, 1);
    assertEquals("5/1/11", converter.convertToString(cal, Locale.US));
    assertEquals(cal, converter.convertToObject("5/1/11", Locale.US));

    try
    {
      converter.convertToObject("whatever", Locale.US);
      fail("Conversion should have thrown an exception");
View Full Code Here

    assertEquals("5/1/11", converter.convertToString(cal, Locale.US));
    assertEquals(cal, converter.convertToObject("5/1/11", Locale.US));

    try
    {
      converter.convertToObject("whatever", Locale.US);
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // this is correct
View Full Code Here

    {
      // this is correct
    }
    try
    {
      converter.convertToObject("5/1/11whatever", Locale.US);
      fail("Conversion should have thrown an exception");
    }
    catch (ConversionException e)
    {
      // this is correct
View Full Code Here

    String expected = styleDateConverter.convertToString(input.getTime(), locale);
    String actual = calendarConverter.convertToString(input, locale);

    Assert.assertEquals(expected, actual);

    Calendar revert = calendarConverter.convertToObject(actual, locale);

    Assert.assertEquals(input, revert);
  }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.