Example usage for org.springframework.mock.web MockHttpServletRequest getPathInfo

List of usage examples for org.springframework.mock.web MockHttpServletRequest getPathInfo

Introduction

In this page you can find the example usage for org.springframework.mock.web MockHttpServletRequest getPathInfo.

Prototype

@Override
    @Nullable
    public String getPathInfo() 

Source Link

Usage

From source file:org.cateproject.test.functional.mockmvc.HtmlUnitRequestBuilder.java

private void servletPath(UriComponents uriComponents, MockHttpServletRequest result) {
    if ("".equals(result.getPathInfo())) {
        result.setPathInfo(null);//from ww w . ja  v  a 2 s  . c  o  m
    }
    servletPath(result, uriComponents.getPath());
}

From source file:org.springframework.test.web.servlet.htmlunit.HtmlUnitRequestBuilderTest.java

@Test
public void buildRequestPathInfo() throws Exception {
    MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext);

    assertThat(actualRequest.getPathInfo()).isEqualTo("/this/here");
}

From source file:org.springframework.test.web.servlet.htmlunit.HtmlUnitRequestBuilderTest.java

@Test
public void buildRequestPathInfoNull() throws Exception {
    webRequest.setUrl(new URL("http://example.com/example"));

    MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext);

    assertThat(actualRequest.getPathInfo()).isNull();
}

From source file:org.springframework.test.web.servlet.htmlunit.HtmlUnitRequestBuilderTests.java

@Test
public void buildRequestPathInfo() throws Exception {
    MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext);

    assertThat(actualRequest.getPathInfo(), nullValue());
}

From source file:org.springframework.test.web.servlet.htmlunit.HtmlUnitRequestBuilderTests.java

@Test
public void buildRequestPathInfoNull() throws Exception {
    webRequest.setUrl(new URL("http://example.com/example"));

    MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext);

    assertThat(actualRequest.getPathInfo(), nullValue());
}

From source file:org.springframework.test.web.servlet.htmlunit.HtmlUnitRequestBuilderTests.java

@Test
public void buildRequestAndAntPathRequestMatcher() throws Exception {
    webRequest.setUrl(new URL("http://example.com/app/login/authenticate"));

    MockHttpServletRequest actualRequest = requestBuilder.buildRequest(servletContext);

    // verify it is going to work with Spring Security's AntPathRequestMatcher
    assertThat(actualRequest.getPathInfo(), nullValue());
    assertThat(actualRequest.getServletPath(), equalTo("/login/authenticate"));
}