11/*
2- * Copyright 2002-2014 the original author or authors.
2+ * Copyright 2002-2015 the original author or authors.
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
1717package org .springframework .http .server ;
1818
1919import java .nio .charset .Charset ;
20- import java .util .Arrays ;
20+ import java .util .Collections ;
2121import java .util .List ;
2222
2323import org .junit .Before ;
2929import org .springframework .mock .web .test .MockHttpServletResponse ;
3030import org .springframework .util .FileCopyUtils ;
3131
32- import static org .junit .Assert .*;
32+ import static org .junit .Assert .assertArrayEquals ;
33+ import static org .junit .Assert .assertEquals ;
34+ import static org .junit .Assert .assertTrue ;
3335
3436/**
3537 * @author Arjen Poutsma
38+ * @author Rossen Stoyanchev
3639 */
3740public class ServletServerHttpResponseTests {
3841
3942 private ServletServerHttpResponse response ;
4043
4144 private MockHttpServletResponse mockResponse ;
4245
46+
4347 @ Before
4448 public void create () throws Exception {
4549 mockResponse = new MockHttpServletResponse ();
4650 response = new ServletServerHttpResponse (mockResponse );
4751 }
4852
53+
4954 @ Test
5055 public void setStatusCode () throws Exception {
5156 response .setStatusCode (HttpStatus .NOT_FOUND );
@@ -73,7 +78,7 @@ public void getHeaders() throws Exception {
7378 }
7479
7580 @ Test
76- public void getHeadersFromHttpServletResponse () {
81+ public void preExistingHeadersFromHttpServletResponse () {
7782
7883 String headerName = "Access-Control-Allow-Origin" ;
7984 String headerValue = "localhost:8080" ;
@@ -82,7 +87,8 @@ public void getHeadersFromHttpServletResponse() {
8287 this .response = new ServletServerHttpResponse (this .mockResponse );
8388
8489 assertEquals (headerValue , this .response .getHeaders ().getFirst (headerName ));
85- assertEquals (Arrays .asList (headerValue ), this .response .getHeaders ().get (headerName ));
90+ assertEquals (Collections .singletonList (headerValue ), this .response .getHeaders ().get (headerName ));
91+ assertTrue (this .response .getHeaders ().containsKey (headerName ));
8692 }
8793
8894 @ Test
0 commit comments