Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8246261: TCKLocalTime.java failed due to "AssertionError: expected [1…
…8:14:22] but found [18:14:23]"

Reviewed-by: lancea, joehw
  • Loading branch information
naotoj committed Jun 2, 2020
1 parent 3dc78e7 commit d347d2ebf9de415e59d04d68f84074e2c1ea334e
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -110,6 +110,7 @@
import java.time.Clock;
import java.time.DateTimeException;
import java.time.DayOfWeek;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
@@ -284,15 +285,8 @@ public void now_ZoneId() {
ZoneId zone = ZoneId.of("UTC+01:02:03");
LocalDateTime expected = LocalDateTime.now(Clock.system(zone));
LocalDateTime test = LocalDateTime.now(zone);
for (int i = 0; i < 100; i++) {
if (expected.equals(test)) {
return;
}
expected = LocalDateTime.now(Clock.system(zone));
test = LocalDateTime.now(zone);
}
assertEquals(test.truncatedTo(ChronoUnit.SECONDS),
expected.truncatedTo(ChronoUnit.SECONDS));
assertEquals(Duration.between(expected, test).truncatedTo(ChronoUnit.SECONDS),
Duration.ZERO);
}

//-----------------------------------------------------------------------
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -241,15 +241,8 @@ public void now_ZoneId() {
ZoneId zone = ZoneId.of("UTC+01:02:03");
LocalTime expected = LocalTime.now(Clock.system(zone));
LocalTime test = LocalTime.now(zone);
for (int i = 0; i < 100; i++) {
if (expected.equals(test)) {
return;
}
expected = LocalTime.now(Clock.system(zone));
test = LocalTime.now(zone);
}
assertEquals(test.truncatedTo(ChronoUnit.SECONDS),
expected.truncatedTo(ChronoUnit.SECONDS));
assertEquals(Duration.between(expected, test).truncatedTo(ChronoUnit.SECONDS),
Duration.ZERO);
}

//-----------------------------------------------------------------------
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -253,15 +253,8 @@ public void now_ZoneId() {
ZoneId zone = ZoneId.of("UTC+01:02:03");
ZonedDateTime expected = ZonedDateTime.now(Clock.system(zone));
ZonedDateTime test = ZonedDateTime.now(zone);
for (int i = 0; i < 100; i++) {
if (expected.equals(test)) {
return;
}
expected = ZonedDateTime.now(Clock.system(zone));
test = ZonedDateTime.now(zone);
}
assertEquals(test.truncatedTo(ChronoUnit.SECONDS),
expected.truncatedTo(ChronoUnit.SECONDS));
assertEquals(Duration.between(expected, test).truncatedTo(ChronoUnit.SECONDS),
Duration.ZERO);
}

//-----------------------------------------------------------------------

0 comments on commit d347d2e

Please sign in to comment.