MockHttpServletResponse.getDateHeader returns -1 for non-existent header

Includes consistent getDateHeader results in both MockHttpServletResponse variants (spring-test and spring-web)

Issue: SPR-16160

(cherry picked from commit 80a0cf7)
This commit is contained in:
Juergen Hoeller
2017-11-05 16:12:21 +01:00
parent 9ca4de1ccf
commit dc0a934c99
4 changed files with 85 additions and 87 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2015 the original author or authors.
* Copyright 2002-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -273,6 +273,12 @@ public class MockHttpServletResponseTests {
response.getDateHeader("Last-Modified");
}
@Test // SPR-16160
public void getNonExistentDateHeader() {
assertNull(response.getHeader("Last-Modified"));
assertEquals(-1, response.getDateHeader("Last-Modified"));
}
@Test // SPR-10414
public void modifyStatusAfterSendError() throws IOException {
response.sendError(HttpServletResponse.SC_NOT_FOUND);