Skip to content

Commit 4cb69a0

Browse files
author
Praful Makani
committed
added test case
1 parent 8bcc333 commit 4cb69a0

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

google-cloud-clients/google-cloud-core/src/test/java/com/google/cloud/TimestampTest.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,15 @@ public void testToString() {
178178

179179
@Test
180180
public void parseTimestamp() {
181+
assertThat(Timestamp.parseTimestamp("0001-01-01T00:00:00Z")).isEqualTo(Timestamp.MIN_VALUE);
182+
assertThat(Timestamp.parseTimestamp("9999-12-31T23:59:59.999999999Z"))
183+
.isEqualTo(Timestamp.MAX_VALUE);
184+
assertThat(Timestamp.parseTimestamp(TEST_TIME_ISO))
185+
.isEqualTo(Timestamp.ofTimeSecondsAndNanos(TEST_TIME_SECONDS, 0));
186+
}
187+
188+
@Test
189+
public void parseTimestampWithoutTimeZoneOffset() {
181190
assertThat(Timestamp.parseTimestamp("0001-01-01T00:00:00")).isEqualTo(Timestamp.MIN_VALUE);
182191
assertThat(Timestamp.parseTimestamp("9999-12-31T23:59:59.999999999"))
183192
.isEqualTo(Timestamp.MAX_VALUE);
@@ -217,6 +226,6 @@ public void comparable() {
217226

218227
@Test
219228
public void serialization() throws Exception {
220-
reserializeAndAssert(Timestamp.parseTimestamp("9999-12-31T23:59:59.999999999"));
229+
reserializeAndAssert(Timestamp.parseTimestamp("9999-12-31T23:59:59.999999999Z"));
221230
}
222231
}

0 commit comments

Comments
 (0)