NIHVIVO-1207 enhance stub classes for unit tests.

This commit is contained in:
jeb228 2010-11-04 14:50:38 +00:00
parent 78df1b181f
commit 631870cad2
4 changed files with 447 additions and 105 deletions

View file

@ -0,0 +1,56 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package stubs.javax.servlet;
import java.util.Enumeration;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
/**
* A simple stub for testing servlets.
*/
public class ServletConfigStub implements ServletConfig {
// ----------------------------------------------------------------------
// Stub infrastructure
// ----------------------------------------------------------------------
private ServletContext servletContext;
public void setServletContext(ServletContext servletContext) {
this.servletContext = servletContext;
}
// ----------------------------------------------------------------------
// Stub methods
// ----------------------------------------------------------------------
@Override
public ServletContext getServletContext() {
return servletContext;
}
// ----------------------------------------------------------------------
// Un-implemented methods
// ----------------------------------------------------------------------
@Override
public String getInitParameter(String arg0) {
throw new RuntimeException(
"ServletConfigStub.getInitParameter() not implemented.");
}
@Override
@SuppressWarnings("rawtypes")
public Enumeration getInitParameterNames() {
throw new RuntimeException(
"ServletConfigStub.getInitParameterNames() not implemented.");
}
@Override
public String getServletName() {
throw new RuntimeException(
"ServletConfigStub.getServletName() not implemented.");
}
}