Search in sources :

Example 11 with NameValuePair

use of com.gargoylesoftware.htmlunit.util.NameValuePair in project spring-framework by spring-projects.

the class HtmlUnitRequestBuilderTests method buildRequestParameterMapViaWebRequestDotSetRequestParametersWithSingleRequestParamWithNullValue.

@Test
public void buildRequestParameterMapViaWebRequestDotSetRequestParametersWithSingleRequestParamWithNullValue() {
    webRequest.setRequestParameters(asList(new NameValuePair("name", null)));
    MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext);
    assertThat(actualRequest.getParameterMap().size(), equalTo(1));
    assertThat(actualRequest.getParameter("name"), nullValue());
}
Also used : NameValuePair(com.gargoylesoftware.htmlunit.util.NameValuePair) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) Test(org.junit.Test)

Example 12 with NameValuePair

use of com.gargoylesoftware.htmlunit.util.NameValuePair in project spring-framework by spring-projects.

the class HtmlUnitRequestBuilderTests method buildRequestParameterMapViaWebRequestDotSetRequestParametersWithSingleRequestParamWithEmptyValue.

@Test
public void buildRequestParameterMapViaWebRequestDotSetRequestParametersWithSingleRequestParamWithEmptyValue() {
    webRequest.setRequestParameters(asList(new NameValuePair("name", "")));
    MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext);
    assertThat(actualRequest.getParameterMap().size(), equalTo(1));
    assertThat(actualRequest.getParameter("name"), equalTo(""));
}
Also used : NameValuePair(com.gargoylesoftware.htmlunit.util.NameValuePair) MockHttpServletRequest(org.springframework.mock.web.MockHttpServletRequest) Test(org.junit.Test)

Aggregations

NameValuePair (com.gargoylesoftware.htmlunit.util.NameValuePair)12 Test (org.junit.Test)7 WebResponse (com.gargoylesoftware.htmlunit.WebResponse)5 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)5 Cookie (javax.servlet.http.Cookie)3 ArrayList (java.util.ArrayList)2 List (java.util.List)1 BasicClientCookie (org.apache.http.impl.cookie.BasicClientCookie)1