This commit is contained in:
Rossen Stoyanchev
2014-07-01 16:09:51 -04:00
parent f6fbdafb6a
commit d3a87a13f7
5 changed files with 85 additions and 102 deletions

View File

@@ -20,15 +20,20 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
/**
* Unit tests for {@link org.springframework.http.RequestEntity}.
* @author Arjen Poutsma
*/
public class RequestEntityTests {
@Test
public void normal() throws URISyntaxException {
String headerName = "My-Custom-Header";
@@ -60,7 +65,7 @@ public class RequestEntityTests {
RequestEntity<?> entity = RequestEntity.method(HttpMethod.GET, url, host, path).build();
assertEquals(expected, entity.getUrl());
Map<String, String> uriVariables = new HashMap<String, String>(2);
Map<String, String> uriVariables = new HashMap<>(2);
uriVariables.put("host", host);
uriVariables.put("path", path);
@@ -105,8 +110,7 @@ public class RequestEntityTests {
assertEquals("text/plain", responseHeaders.getFirst("Accept"));
assertEquals("utf-8", responseHeaders.getFirst("Accept-Charset"));
assertEquals("Thu, 01 Jan 1970 00:00:12 GMT",
responseHeaders.getFirst("If-Modified-Since"));
assertEquals("Thu, 01 Jan 1970 00:00:12 GMT", responseHeaders.getFirst("If-Modified-Since"));
assertEquals(ifNoneMatch, responseHeaders.getFirst("If-None-Match"));
assertEquals(String.valueOf(contentLength), responseHeaders.getFirst("Content-Length"));
assertEquals(contentType.toString(), responseHeaders.getFirst("Content-Type"));
@@ -141,7 +145,4 @@ public class RequestEntityTests {
}
}