String expectedURI = "/ctx/baz?baz=barney";
train_encodeURL(response, expectedURI, expectedURI);
replay();
Link link = new LinkImpl("/ctx/foo", false, LinkSecurity.INSECURE, response, null, null);
link.addParameter("baz", "barney");
link.setAnchor("jacob");
Link copy = link.copyWithBasePath("/ctx/baz");
assertEquals(copy.toURI(), expectedURI + "#jacob");
verify();
}