.setResponseString("response string").setHttpStatusCode(200).addHeader("h1", "v1")
.addHeader("h2", "v2").addHeader("Cache-Control", "private,no-store,max-age=10")
.addHeader("Expires", "123").create();
HttpServletResponse servletResponse = EasyMock.createMock(HttpServletResponse.class);
HttpServletResponseRecorder recorder = new HttpServletResponseRecorder(servletResponse);
long testStartTime = fakeTime.currentTimeMillis();
ServletUtil.copyToServletResponseAndOverrideCacheHeaders(response, recorder);
assertEquals(200, recorder.getHttpStatusCode());
assertEquals("response string", recorder.getResponseAsString());
assertEquals("v1", recorder.getHeader("h1"));
assertEquals("v2", recorder.getHeader("h2"));
assertEquals("no-cache", recorder.getHeader("Cache-Control"));
long expires = DateUtil.parseRfc1123Date(recorder.getHeader("Expires")).getTime();
assertGreater(testStartTime - 2000L, expires);
assertLesser(testStartTime + 2000L, expires);
}