Example #1
0
 @Test
 public void testCalendar2Timestamp() {
   Calendar calendar = Calendar.getInstance();
   calendar.setTimeInMillis(time);
   Time sqltime = sqlTimeConverter.convert(calendar);
   assertEquals(time, sqltime.getTime());
 }
Example #2
0
  @Test
  public void testConversion() {
    assertNull(sqlTimeConverter.convert(null));

    assertEquals(Time.valueOf("00:01:02"), sqlTimeConverter.convert(Time.valueOf("00:01:02")));
    assertEquals(new Time(60), sqlTimeConverter.convert(Integer.valueOf(60)));
    assertEquals(Time.valueOf("00:01:02"), sqlTimeConverter.convert("00:01:02"));
    assertEquals(Time.valueOf("00:01:02"), sqlTimeConverter.convert("       00:01:02    "));

    try {
      sqlTimeConverter.convert("00:01");
      fail();
    } catch (TypeConversionException ignore) {
    }

    try {
      sqlTimeConverter.convert("a");
      fail();
    } catch (TypeConversionException ignore) {
    }
  }
Example #3
0
 @Test
 public void testJDateTime2Timestamp() {
   JDateTime jdt = new JDateTime(time);
   Time sqltime = sqlTimeConverter.convert(jdt);
   assertEquals(time, sqltime.getTime());
 }
Example #4
0
 @Test
 public void testSqlTime2Timestamp() {
   Time sqltime2 = new Time(time);
   Time sqltime = sqlTimeConverter.convert(sqltime2);
   assertEquals(time, sqltime.getTime());
 }
Example #5
0
 @Test
 public void testSqlDate2Timestamp() {
   java.sql.Date date = new java.sql.Date(time);
   Time sqltime = sqlTimeConverter.convert(date);
   assertEquals(time, sqltime.getTime());
 }
Example #6
0
 @Test
 public void testNull() {
   assertNull(sqlTimeConverter.convert(null));
 }