MockHttpServletResponse's getHeaderNames declares Collection instead of Set for Servlet 3.0 compatibility

Issue: SPR-9885
This commit is contained in:
Juergen Hoeller
2013-01-21 11:33:13 +01:00
committed by unknown
parent c1a4f5c0fe
commit 5a773b771d
3 changed files with 17 additions and 18 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 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.
@@ -16,18 +16,17 @@
package org.springframework.mock.web;
import static org.junit.Assert.*;
import java.io.IOException;
import java.util.Arrays;
import java.util.Set;
import java.util.Collection;
import javax.servlet.http.HttpServletResponse;
import org.junit.Test;
import org.springframework.web.util.WebUtils;
import static org.junit.Assert.*;
/**
* Unit tests for {@link MockHttpServletResponse}.
*
@@ -127,7 +126,7 @@ public class MockHttpServletResponseTests {
public void httpHeaderNameCasingIsPreserved() throws Exception {
final String headerName = "Header1";
response.addHeader(headerName, "value1");
Set<String> responseHeaders = response.getHeaderNames();
Collection<String> responseHeaders = response.getHeaderNames();
assertNotNull(responseHeaders);
assertEquals(1, responseHeaders.size());
assertEquals("HTTP header casing not being preserved", headerName, responseHeaders.iterator().next());