testRunner.setTestComplete(true);
final String FOREIGNEXTERNALURL_TEST_STRING = "http://www.apache.org";
FacesContext ctx = FacesContext.getCurrentInstance();
ExternalContext extCtx = ctx.getExternalContext();
if (extCtx.encodeResourceURL(FOREIGNEXTERNALURL_TEST_STRING).equals(((PortletResponse) extCtx.getResponse()).encodeURL(FOREIGNEXTERNALURL_TEST_STRING).replace("&", "&")))
{
testRunner.setTestResult(true,
"encodeResourceURL correctly encoded a foreign external URL.");
return Constants.TEST_SUCCESS;
}