@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); }
@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); }
@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); }