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

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

Introduction

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

Prototype

public void setLocalName(String localName) 

Source Link

Usage

From source file:com.amashchenko.struts2.pdfstream.PdfStreamResultTest.java

@Test
public void testFindBaseUrl() throws Exception {
    Assert.assertNotNull(pdfStreamResult);

    MockHttpServletRequest request = new MockHttpServletRequest();

    request.setLocalName("localhost");
    request.setRequestURI("/contextPath/requestURI");
    request.setQueryString("queryString");
    request.setContextPath("/contextPath");

    final String baseUrl = pdfStreamResult.findBaseUrl(request);

    Assert.assertEquals("http://localhost/contextPath/", baseUrl);
}