Skip to content
This repository has been archived by the owner on Dec 3, 2023. It is now read-only.

Commit

Permalink
test: failing test for parsing a negative timestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
chingor13 committed Feb 19, 2020
1 parent ebc0e6c commit 0c32d16
Showing 1 changed file with 24 additions and 0 deletions.
Expand Up @@ -80,6 +80,30 @@ public void ofDate() {
assertThat(timestamp.getNanos()).isEqualTo(expectedNanos);
}

@Test
public void ofSqlTimestamp() {
String expectedTimestamp = "1970-01-01T00:00:12.345000000Z";
java.sql.Timestamp input = new java.sql.Timestamp(12345);
Timestamp timestamp = Timestamp.of(input);
assertThat(timestamp.toString()).isEqualTo(expectedTimestamp);
}

@Test
public void ofSqlTimestampPreEpoch() {
String expectedTimestamp = "1969-12-31T23:59:47.655000000Z";
java.sql.Timestamp input = new java.sql.Timestamp(-12345);
Timestamp timestamp = Timestamp.of(input);
assertThat(timestamp.toString()).isEqualTo(expectedTimestamp);
}

@Test
public void ofSqlTimestampOnEpoch() {
String expectedTimestamp = "1970-01-01T00:00:00Z";
java.sql.Timestamp input = new java.sql.Timestamp(0);
Timestamp timestamp = Timestamp.of(input);
assertThat(timestamp.toString()).isEqualTo(expectedTimestamp);
}

@Test
public void ofDatePreEpoch() {
Timestamp timestamp = Timestamp.of(TEST_DATE_PRE_EPOCH);
Expand Down

0 comments on commit 0c32d16

Please sign in to comment.