public Timestamp convertDateToTimestamp( Date date ) throws KettleValueException {
    if ( date == null ) {
      return null;
    }
    Timestamp result = null;
    if ( date instanceof Timestamp ) {
      result = (Timestamp) date;
    } else {
      result = new Timestamp( date.getTime() );
    }
    return result;
  }
@Test
  public void testConvertDateToTimestamp() throws Exception {
    ValueMetaTimestamp valueMetaTimestamp = new ValueMetaTimestamp();
    // Converting date to timestamp
    Date date = new Date();
    assertEquals( valueMetaTimestamp.convertDateToTimestamp( date ).getTime(), date.getTime() );

    // Converting timestamp to timestamp
    Timestamp timestamp = Timestamp.valueOf( "2014-04-05 04:03:02.123456789" );
    Timestamp convertedTimestamp = valueMetaTimestamp.convertDateToTimestamp( timestamp );
    assertEquals( convertedTimestamp.getTime(), timestamp.getTime() );
    assertEquals( convertedTimestamp.getNanos(), timestamp.getNanos() );
  }