Package org.beangle.web.util

Source Code of org.beangle.web.util.RequestUtilsTest

/* Copyright c 2005-2012.
* Licensed under GNU  LESSER General Public License, Version 3.
* http://www.gnu.org/licenses
*/
package org.beangle.web.util;

import org.springframework.mock.web.MockHttpServletRequest;
import org.testng.Assert;
import org.testng.annotations.Test;

@Test
public class RequestUtilsTest {

  public void testGetServletPath() {
    MockHttpServletRequest request = new MockHttpServletRequest(null, "/");
    request.setContextPath("/");
    Assert.assertEquals(RequestUtils.getServletPath(request), "");
    request.setContextPath("/");
    request.setRequestURI("/demo");
    Assert.assertEquals(RequestUtils.getServletPath(request), "/demo");

    request.setContextPath("");
    request.setRequestURI("/demo");
    Assert.assertEquals(RequestUtils.getServletPath(request), "/demo");
  }
}
TOP

Related Classes of org.beangle.web.util.RequestUtilsTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.