mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Modernize java.time API usages
See gh-35861 Signed-off-by: Vincent Potucek <vpotucek@me.com>
This commit is contained in:
committed by
Sébastien Deleuze
parent
3686b89ab5
commit
83bbf16e6c
@@ -18,6 +18,7 @@ package org.springframework.test.http;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Arrays;
|
||||
@@ -42,7 +43,7 @@ import org.springframework.http.HttpHeaders;
|
||||
*/
|
||||
public class HttpHeadersAssert extends AbstractObjectAssert<HttpHeadersAssert, HttpHeaders> {
|
||||
|
||||
private static final ZoneId GMT = ZoneId.of("GMT");
|
||||
private static final ZoneId GMT = ZoneOffset.UTC;
|
||||
|
||||
|
||||
private final AbstractCollectionAssert<?, Collection<? extends String>, String, ObjectAssert<String>> namesAssert;
|
||||
@@ -173,7 +174,7 @@ public class HttpHeadersAssert extends AbstractObjectAssert<HttpHeadersAssert, H
|
||||
containsHeader(name);
|
||||
Assertions.assertThat(this.actual.getFirstZonedDateTime(name))
|
||||
.as("check primary date value for HTTP header '%s'", name)
|
||||
.isCloseTo(ZonedDateTime.ofInstant(value, GMT), Assertions.within(999, ChronoUnit.MILLIS));
|
||||
.isCloseTo(value.atZone(GMT), Assertions.within(999, ChronoUnit.MILLIS));
|
||||
return this.myself;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user