mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-08 09:35:16 +00:00
8246261: TCKLocalTime.java failed due to "AssertionError: expected [18:14:22] but found [18:14:23]"
Reviewed-by: lancea, joehw
This commit is contained in:
parent
3dc78e76e4
commit
d347d2ebf9
@ -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 static org.testng.Assert.fail;
|
||||
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 class TCKLocalDateTime extends AbstractDateTimeTest {
|
||||
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 class TCKLocalTime extends AbstractDateTimeTest {
|
||||
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 class TCKZonedDateTime extends AbstractDateTimeTest {
|
||||
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);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user