|
22 | 22 | import java.lang.reflect.Method; |
23 | 23 | import java.net.URI; |
24 | 24 | import java.nio.charset.StandardCharsets; |
25 | | -import java.time.ZoneId; |
26 | 25 | import java.time.ZoneOffset; |
27 | 26 | import java.time.ZonedDateTime; |
28 | 27 | import java.util.Arrays; |
|
98 | 97 | */ |
99 | 98 | class HttpEntityMethodProcessorMockTests { |
100 | 99 |
|
101 | | - private static final ZoneId GMT = ZoneOffset.UTC; |
102 | | - |
103 | | - |
104 | 100 | private HttpEntityMethodProcessor processor; |
105 | 101 |
|
106 | 102 | private HttpMessageConverter<String> stringHttpMessageConverter = mock(); |
@@ -477,7 +473,7 @@ void shouldHandleResponseHeaderAndBody() throws Exception { |
477 | 473 | void shouldHandleLastModifiedWithHttp304() throws Exception { |
478 | 474 | long currentTime = new Date().getTime(); |
479 | 475 | long oneMinuteAgo = currentTime - (1000 * 60); |
480 | | - ZonedDateTime dateTime = ofEpochMilli(currentTime).atZone(GMT); |
| 476 | + ZonedDateTime dateTime = ofEpochMilli(currentTime).atZone(ZoneOffset.UTC); |
481 | 477 | servletRequest.addHeader(HttpHeaders.IF_MODIFIED_SINCE, RFC_1123_DATE_TIME.format(dateTime)); |
482 | 478 | ResponseEntity<String> returnValue = ResponseEntity.ok().lastModified(oneMinuteAgo).body("body"); |
483 | 479 |
|
@@ -537,7 +533,7 @@ void shouldHandleETagAndLastModifiedWithHttp304() throws Exception { |
537 | 533 | long currentTime = new Date().getTime(); |
538 | 534 | long oneMinuteAgo = currentTime - (1000 * 60); |
539 | 535 | String etagValue = "\"deadb33f8badf00d\""; |
540 | | - ZonedDateTime dateTime = ofEpochMilli(currentTime).atZone(GMT); |
| 536 | + ZonedDateTime dateTime = ofEpochMilli(currentTime).atZone(ZoneOffset.UTC); |
541 | 537 | servletRequest.addHeader(HttpHeaders.IF_MODIFIED_SINCE, RFC_1123_DATE_TIME.format(dateTime)); |
542 | 538 | servletRequest.addHeader(HttpHeaders.IF_NONE_MATCH, etagValue); |
543 | 539 | ResponseEntity<String> returnValue = ResponseEntity.ok() |
@@ -569,7 +565,7 @@ void shouldHandleChangedETagAndLastModified() throws Exception { |
569 | 565 | long oneMinuteAgo = currentTime - (1000 * 60); |
570 | 566 | String etagValue = "\"deadb33f8badf00d\""; |
571 | 567 | String changedEtagValue = "\"changed-etag-value\""; |
572 | | - ZonedDateTime dateTime = ofEpochMilli(currentTime).atZone(GMT); |
| 568 | + ZonedDateTime dateTime = ofEpochMilli(currentTime).atZone(ZoneOffset.UTC); |
573 | 569 | servletRequest.addHeader(HttpHeaders.IF_MODIFIED_SINCE, RFC_1123_DATE_TIME.format(dateTime)); |
574 | 570 | servletRequest.addHeader(HttpHeaders.IF_NONE_MATCH, etagValue); |
575 | 571 | ResponseEntity<String> returnValue = ResponseEntity.ok() |
@@ -625,7 +621,7 @@ void shouldHandleIfNoneMatchIfMatch() throws Exception { |
625 | 621 | void shouldHandleIfNoneMatchIfUnmodifiedSince() throws Exception { |
626 | 622 | String etagValue = "\"some-etag\""; |
627 | 623 | servletRequest.addHeader(HttpHeaders.IF_NONE_MATCH, etagValue); |
628 | | - ZonedDateTime dateTime = ofEpochMilli(new Date().getTime()).atZone(GMT); |
| 624 | + ZonedDateTime dateTime = ofEpochMilli(new Date().getTime()).atZone(ZoneOffset.UTC); |
629 | 625 | servletRequest.addHeader(HttpHeaders.IF_UNMODIFIED_SINCE, RFC_1123_DATE_TIME.format(dateTime)); |
630 | 626 | ResponseEntity<String> returnValue = ResponseEntity.ok().eTag(etagValue).body("body"); |
631 | 627 |
|
@@ -732,7 +728,7 @@ void shouldHandleValidatorHeadersInputResponses() throws Exception { |
732 | 728 | @Test |
733 | 729 | void shouldNotFailPreconditionForPutRequests() throws Exception { |
734 | 730 | servletRequest.setMethod("PUT"); |
735 | | - ZonedDateTime dateTime = ofEpochMilli(new Date().getTime()).atZone(GMT); |
| 731 | + ZonedDateTime dateTime = ofEpochMilli(new Date().getTime()).atZone(ZoneOffset.UTC); |
736 | 732 | servletRequest.addHeader(HttpHeaders.IF_UNMODIFIED_SINCE, RFC_1123_DATE_TIME.format(dateTime)); |
737 | 733 |
|
738 | 734 | long justModified = dateTime.plusSeconds(1).toEpochSecond() * 1000; |
|
0 commit comments