This repository was archived by the owner on Dec 3, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Failed to load files.
Original file line numberDiff line numberDiff line change
Expand Up@@ -80,6 +80,30 @@ public void ofDate() {
assertThat(timestamp.getNanos()).isEqualTo(expectedNanos);
}

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

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

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

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