com.mockrunner.struts.ExceptionHandlerConfig Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of mockrunner-jdk1.3-j2ee1.3 Show documentation
Show all versions of mockrunner-jdk1.3-j2ee1.3 Show documentation
Mockrunner is a lightweight framework for unit testing applications
in the J2EE environment. It supports servlets, filters, tag classes
and Struts actions. It includes a JDBC a JMS and a JCA test
framework and can be used to test EJB based applications.
The newest version!
package com.mockrunner.struts;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
/**
* Generic interface for exception handlers. The default implementation
* is {@link DefaultExceptionHandlerConfig} and uses the Struts
* exception handling mechanism. In special cases, you may provide your own
* implementations of this interface, that may be independent from
* the Struts exception handling mechanism.
* Exception handler are called if an action throws an exception.
* Use {@link ActionTestModule#addExceptionHandler} to register an exception handler.
*/
public interface ExceptionHandlerConfig
{
/**
* Returns if this handler is able to handle the exception.
* @return true
if this handler is able to handle the exception,
* false
otherwise
*/
public boolean canHandle(Exception exception);
/**
* Handles the exception.
* @param exception the exception
* @param mapping the current ActionMapping
* @param form the current ActionForm
* @param request the current request
* @param response the current response
* @return the handler return value, usually an ActionForward
,
* but may be any object
*/
public Object handle(Exception exception, ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception;
}