@Test
  @Concurrent(count=4)
  @Repeating(repetition=100)
  public void testSerializationFormatDirectly() throws IOException {
    assertEquals("1970-01-01 00:00:00", fromIntAndVInts(0).toString());
    assertEquals("1970-01-01 00:00:01", fromIntAndVInts(1).toString());
    assertEquals("1970-01-01 00:05:00", fromIntAndVInts(300).toString());
    assertEquals("1970-01-01 02:00:00", fromIntAndVInts(7200).toString());
    assertEquals("2000-01-02 03:04:05", fromIntAndVInts(946782245).toString());

    // This won't have a decimal part because the HAS_DECIMAL_MASK bit is not set.
    assertEquals("2000-01-02 03:04:05", fromIntAndVInts(946782245, 3210).toString());

    assertEquals("2000-01-02 03:04:05.0123",
      fromIntAndVInts(946782245 | HAS_DECIMAL_MASK, 3210).toString());

    assertEquals("2038-01-19 03:14:07", fromIntAndVInts(Integer.MAX_VALUE).toString());
    assertEquals("2038-01-19 03:14:07.012345678",
      fromIntAndVInts(Integer.MAX_VALUE | HAS_DECIMAL_MASK,  // this is really just -1
        876543210).toString());

    // Timestamps with a second VInt storing additional bits of the seconds field.
    long seconds = 253392390415L;
    assertEquals("9999-09-08 07:06:55",
      fromIntAndVInts((int) (seconds & 0x7fffffff) | (1 << 31), -1L, seconds >> 31).toString());
    assertEquals("9999-09-08 07:06:55.0123",
      fromIntAndVInts((int) (seconds & 0x7fffffff) | (1 << 31),
                      -3210 - 1, seconds >> 31).toString());
  }
Test timestamps that don't necessarily fit between 1970 and 2038. This depends on HIVE-4525
being fixed.
serde/src/test/org/apache/hadoop/hive/serde2/io/TestTimestampWritableV2.java