NIHVIVO-1207 enhance stub classes for unit tests.
This commit is contained in:
parent
78df1b181f
commit
631870cad2
4 changed files with 447 additions and 105 deletions
56
webapp/test/stubs/javax/servlet/ServletConfigStub.java
Normal file
56
webapp/test/stubs/javax/servlet/ServletConfigStub.java
Normal 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.");
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue