From: Steve F. <sm...@us...> - 2002-08-21 23:49:43
|
Update of /cvsroot/mockobjects/no-stone-unturned/src/nostone/addressbook In directory usw-pr-cvs1:/tmp/cvs-serv3836/src/nostone/addressbook Modified Files: AddressBookServletTest.java Log Message: First test runs, but doesn't test anything. Index: AddressBookServletTest.java =================================================================== RCS file: /cvsroot/mockobjects/no-stone-unturned/src/nostone/addressbook/AddressBookServletTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- AddressBookServletTest.java 21 Aug 2002 21:58:34 -0000 1.1 +++ AddressBookServletTest.java 21 Aug 2002 23:49:39 -0000 1.2 @@ -4,7 +4,7 @@ import javax.servlet.http.*; import javax.servlet.ServletException; -import java.io.IOException; +import java.io.*; public class AddressBookServletTest extends TestCase { public AddressBookServletTest(String name) { @@ -12,11 +12,29 @@ } public void testNoEntries() throws ServletException, IOException { - HttpServletRequest mockRequest = new NullHttpServletRequest(); - HttpServletResponse mockResponse = new NullHttpServletResponse(); + final StringWriter page = new StringWriter(); - AddressBookServlet servlet = new AddressBookServlet(); + HttpServletRequest mockRequest = new NullHttpServletRequest() { + public String getMethod() { + return "PUT"; + } + public String getProtocol() { + return "HTTP/1.1"; + } + }; + HttpServletResponse mockResponse = new NullHttpServletResponse() /*{ + public void setContentType(String contentType) { + assertEquals("Should be content type", "text/plain", contentType); + } + + public PrintWriter getWriter() throws IOException { + return new PrintWriter(page); + } + }*/; + AddressBookServlet servlet = new AddressBookServlet(); servlet.service(mockRequest, mockResponse); + + // assertEquals("Response page", "No address found", page.toString()); } } |