Java Code Examples for org.springframework.mock.web.MockHttpServletRequest#getCookies()
The following examples show how to use
org.springframework.mock.web.MockHttpServletRequest#getCookies() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MockHttpServletRequestBuilderTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void cookie() { Cookie cookie1 = new Cookie("foo", "bar"); Cookie cookie2 = new Cookie("baz", "qux"); this.builder.cookie(cookie1, cookie2); MockHttpServletRequest request = this.builder.buildRequest(this.servletContext); Cookie[] cookies = request.getCookies(); assertEquals(2, cookies.length); assertEquals("foo", cookies[0].getName()); assertEquals("bar", cookies[0].getValue()); assertEquals("baz", cookies[1].getName()); assertEquals("qux", cookies[1].getValue()); }
Example 2
Source File: HtmlUnitRequestBuilderTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void buildRequestCookiesSingle() { webRequest.setAdditionalHeader("Cookie", "name=value"); MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext); Cookie[] cookies = actualRequest.getCookies(); assertThat(cookies.length, equalTo(1)); assertThat(cookies[0].getName(), equalTo("name")); assertThat(cookies[0].getValue(), equalTo("value")); }
Example 3
Source File: HtmlUnitRequestBuilderTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void buildRequestCookiesMulti() { webRequest.setAdditionalHeader("Cookie", "name=value; name2=value2"); MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext); Cookie[] cookies = actualRequest.getCookies(); assertThat(cookies.length, equalTo(2)); Cookie cookie = cookies[0]; assertThat(cookie.getName(), equalTo("name")); assertThat(cookie.getValue(), equalTo("value")); cookie = cookies[1]; assertThat(cookie.getName(), equalTo("name2")); assertThat(cookie.getValue(), equalTo("value2")); }
Example 4
Source File: MockHttpServletRequestBuilderTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void cookie() { Cookie cookie1 = new Cookie("foo", "bar"); Cookie cookie2 = new Cookie("baz", "qux"); this.builder.cookie(cookie1, cookie2); MockHttpServletRequest request = this.builder.buildRequest(this.servletContext); Cookie[] cookies = request.getCookies(); assertEquals(2, cookies.length); assertEquals("foo", cookies[0].getName()); assertEquals("bar", cookies[0].getValue()); assertEquals("baz", cookies[1].getName()); assertEquals("qux", cookies[1].getValue()); }
Example 5
Source File: HtmlUnitRequestBuilderTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void buildRequestCookiesSingle() { webRequest.setAdditionalHeader("Cookie", "name=value"); MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext); Cookie[] cookies = actualRequest.getCookies(); assertThat(cookies.length, equalTo(1)); assertThat(cookies[0].getName(), equalTo("name")); assertThat(cookies[0].getValue(), equalTo("value")); }
Example 6
Source File: HtmlUnitRequestBuilderTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void buildRequestCookiesMulti() { webRequest.setAdditionalHeader("Cookie", "name=value; name2=value2"); MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext); Cookie[] cookies = actualRequest.getCookies(); assertThat(cookies.length, equalTo(2)); Cookie cookie = cookies[0]; assertThat(cookie.getName(), equalTo("name")); assertThat(cookie.getValue(), equalTo("value")); cookie = cookies[1]; assertThat(cookie.getName(), equalTo("name2")); assertThat(cookie.getValue(), equalTo("value2")); }
Example 7
Source File: MockHttpServletRequestBuilderTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void cookie() { Cookie cookie1 = new Cookie("foo", "bar"); Cookie cookie2 = new Cookie("baz", "qux"); this.builder.cookie(cookie1, cookie2); MockHttpServletRequest request = this.builder.buildRequest(this.servletContext); Cookie[] cookies = request.getCookies(); assertEquals(2, cookies.length); assertEquals("foo", cookies[0].getName()); assertEquals("bar", cookies[0].getValue()); assertEquals("baz", cookies[1].getName()); assertEquals("qux", cookies[1].getValue()); }
Example 8
Source File: HtmlUnitRequestBuilderTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void buildRequestCookiesSingle() { webRequest.setAdditionalHeader("Cookie", "name=value"); MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext); Cookie[] cookies = actualRequest.getCookies(); assertThat(cookies.length, equalTo(1)); assertThat(cookies[0].getName(), equalTo("name")); assertThat(cookies[0].getValue(), equalTo("value")); }
Example 9
Source File: HtmlUnitRequestBuilderTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void buildRequestCookiesMulti() { webRequest.setAdditionalHeader("Cookie", "name=value; name2=value2"); MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext); Cookie[] cookies = actualRequest.getCookies(); assertThat(cookies.length, equalTo(2)); Cookie cookie = cookies[0]; assertThat(cookie.getName(), equalTo("name")); assertThat(cookie.getValue(), equalTo("value")); cookie = cookies[1]; assertThat(cookie.getName(), equalTo("name2")); assertThat(cookie.getValue(), equalTo("value2")); }