diff --git a/webapp/test/stubs/javax/servlet/http/HttpServletResponseStub.java b/webapp/test/stubs/javax/servlet/http/HttpServletResponseStub.java index 53b24c5ca..e32afa373 100644 --- a/webapp/test/stubs/javax/servlet/http/HttpServletResponseStub.java +++ b/webapp/test/stubs/javax/servlet/http/HttpServletResponseStub.java @@ -4,6 +4,7 @@ package stubs.javax.servlet.http; import java.io.IOException; import java.io.PrintWriter; +import java.io.StringWriter; import java.util.Locale; import javax.servlet.ServletOutputStream; @@ -19,11 +20,22 @@ public class HttpServletResponseStub implements HttpServletResponse { // ---------------------------------------------------------------------- private String redirectLocation; + private int status = 200; + private String errorMessage; + private StringWriter outputWriter = new StringWriter(); public String getRedirectLocation() { return redirectLocation; } + public int getStatus() { + return status; + } + + public String getErrorMessage() { + return errorMessage; + } + // ---------------------------------------------------------------------- // Stub methods // ---------------------------------------------------------------------- @@ -33,6 +45,22 @@ public class HttpServletResponseStub implements HttpServletResponse { this.redirectLocation = location; } + @Override + public void sendError(int status) throws IOException { + this.status = status; + } + + @Override + public void sendError(int status, String message) throws IOException { + this.status = status; + this.errorMessage = message; + } + + @Override + public PrintWriter getWriter() throws IOException { + return new PrintWriter(outputWriter); + } + // ---------------------------------------------------------------------- // Un-implemented methods // ---------------------------------------------------------------------- @@ -73,12 +101,6 @@ public class HttpServletResponseStub implements HttpServletResponse { "HttpServletResponseStub.getOutputStream() not implemented."); } - @Override - public PrintWriter getWriter() throws IOException { - throw new RuntimeException( - "HttpServletResponseStub.getWriter() not implemented."); - } - @Override public boolean isCommitted() { throw new RuntimeException( @@ -181,18 +203,6 @@ public class HttpServletResponseStub implements HttpServletResponse { "HttpServletResponseStub.encodeUrl() not implemented."); } - @Override - public void sendError(int arg0) throws IOException { - throw new RuntimeException( - "HttpServletResponseStub.sendError() not implemented."); - } - - @Override - public void sendError(int arg0, String arg1) throws IOException { - throw new RuntimeException( - "HttpServletResponseStub.sendError() not implemented."); - } - @Override public void setDateHeader(String arg0, long arg1) { throw new RuntimeException(