* @see AbstractWebTestCaller#setTestCaseFields(AbstractTestCase)
*/
protected void setTestCaseFields(AbstractTestCase theTestInstance)
throws Exception
{
FilterTestCase filterInstance = (FilterTestCase) theTestInstance;
FilterImplicitObjects filterImplicitObjects =
(FilterImplicitObjects) this.webImplicitObjects;
// Sets the request field of the test case class
// ---------------------------------------------
// Extract from the HTTP request the URL to simulate (if any)
HttpServletRequest request =
filterImplicitObjects.getHttpServletRequest();
ServletURL url = ServletURL.loadFromRequest(request);
Field requestField = filterInstance.getClass().getField("request");
requestField.set(filterInstance,
new HttpServletRequestWrapper(request, url));
// Set the response field of the test case class
// ---------------------------------------------
Field responseField = filterInstance.getClass().getField("response");
responseField.set(filterInstance,
filterImplicitObjects.getHttpServletResponse());
// Set the config field of the test case class
// -------------------------------------------
Field configField = filterInstance.getClass().getField("config");
configField.set(filterInstance,
new FilterConfigWrapper(filterImplicitObjects.getFilterConfig()));
// Set the filter chain of the test case class
// -------------------------------------------
Field chainField = filterInstance.getClass().getField("filterChain");
chainField.set(filterInstance,
filterImplicitObjects.getFilterChain());
}