mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
added some uri util methods
This commit is contained in:
@@ -54,6 +54,22 @@ import javax.servlet.http.HttpServletRequest;
|
||||
public class HttpUtilTest
|
||||
{
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void getCompleteUrlTest()
|
||||
{
|
||||
ScmConfiguration config = new ScmConfiguration();
|
||||
|
||||
config.setBaseUrl("http://www.scm-manager.org/scm");
|
||||
assertEquals("http://www.scm-manager.org/scm/test/path",
|
||||
HttpUtil.getCompleteUrl(config, "test/path"));
|
||||
assertEquals("http://www.scm-manager.org/scm/test/path",
|
||||
HttpUtil.getCompleteUrl(config, "/test/path"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
@@ -103,14 +119,31 @@ public class HttpUtilTest
|
||||
HttpUtil.getStrippedURI(request, "/scm/test/path"));
|
||||
assertEquals("/test/path", HttpUtil.getStrippedURI(request));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void getCompleteUrlTest()
|
||||
public void getUriWithoutEndSeperatorTest()
|
||||
{
|
||||
ScmConfiguration config = new ScmConfiguration();
|
||||
config.setBaseUrl("http://www.scm-manager.org/scm");
|
||||
|
||||
assertEquals("http://www.scm-manager.org/scm/test/path", HttpUtil.getCompleteUrl(config, "test/path"));
|
||||
assertEquals("http://www.scm-manager.org/scm/test/path", HttpUtil.getCompleteUrl(config, "/test/path"));
|
||||
assertEquals("/test", HttpUtil.getUriWithoutEndSeperator("/test/"));
|
||||
assertEquals("/test/two", HttpUtil.getUriWithoutEndSeperator("/test/two/"));
|
||||
assertEquals("/test/two/three",
|
||||
HttpUtil.getUriWithoutEndSeperator("/test/two/three"));
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void getUriWithoutStartSeperator()
|
||||
{
|
||||
assertEquals("test/", HttpUtil.getUriWithoutStartSeperator("/test/"));
|
||||
assertEquals("test/two/",
|
||||
HttpUtil.getUriWithoutStartSeperator("/test/two/"));
|
||||
assertEquals("test/two/three",
|
||||
HttpUtil.getUriWithoutStartSeperator("test/two/three"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user