Beispiel #1
0
  @Test
  public void testGetRedirectURL_absolute() {
    RedirectRunResult rrr = new RedirectRunResult("http://www.google.com");

    String result = URLUtils.getRedirectURL(rrr, "http://localhost:9001/hula/checkout", "/hula");

    Assert.assertEquals("incorrect result url", "http://www.google.com", result);
  }
Beispiel #2
0
  @Test
  public void testGetRedirectURL_relativeWithPort() {
    RedirectRunResult rrr = new RedirectRunResult("login");

    String result = URLUtils.getRedirectURL(rrr, "http://localhost:9001/hula/checkout", "/hula");

    Assert.assertEquals("incorrect result url", "http://localhost:9001/hula/login", result);
  }
Beispiel #3
0
  @Test
  public void testGetRedirectURL_relativeWithParams() {
    RedirectRunResult rrr = new RedirectRunResult("login");
    Map<String, String> params = new LinkedHashMap<String, String>();
    params.put("name", "Jeff");
    params.put("age", "32");
    rrr.setParameters(params);

    String result = URLUtils.getRedirectURL(rrr, "http://localhost:9001/hula/checkout", "/hula");

    Assert.assertEquals(
        "incorrect result url", "http://localhost:9001/hula/login?name=Jeff&age=32", result);
  }
Beispiel #4
0
 @Test
 public void testGetScriptName() {
   String result = URLUtils.getScriptName("http://localhost:9001/welcome", "");
   Assert.assertEquals("incorrect script", "welcome", result);
 }
Beispiel #5
0
 @Test
 public void testGetScriptName_withContextAndFolder() {
   String result = URLUtils.getScriptName("http://localhost:9001/hula/checkout/welcome", "/hula");
   Assert.assertEquals("incorrect script", "checkout/welcome", result);
 }