예제 #1
0
 public void test_doGet_noPathInfo() {
   TestUtil.writeFile("_test_", "Data for empty path.");
   servlet.prefix = "_test_";
   servlet.doGet(new ServletRequestFixture(null), response);
   TestUtil.deleteTree("_test_");
   assertEquals("information returned", "Data for empty path.", response.toString());
 }
예제 #2
0
 public void test_return404_exceptionReturningError() {
   response.sendErrorException = true;
   StaticServlet.return404(response);
   assertEquals(
       "log4j log output",
       "I/O error sending 404 error in StaticServlet.return404: " + "exception in sendError",
       log4jLog.log.toString());
 }
예제 #3
0
 public void test_doGet_basics() {
   (new File("_test_")).mkdir();
   TestUtil.writeFile("_test_/abc", "Sample file to return.");
   servlet.prefix = "_test_/";
   servlet.doGet(new ServletRequestFixture("abc"), response);
   TestUtil.deleteTree("_test_");
   assertEquals("information returned", "Sample file to return.", response.toString());
 }
예제 #4
0
 public void test_returnFile_cantOpenOutputStream() throws ServletException {
   TestUtil.writeFile("_test_", "Sample file to return.");
   response.getOutputStreamException = true;
   StaticServlet.returnFile("_test_", context, response);
   assertEquals(
       "log4j log output",
       "I/O error retrieving response output stream in "
           + "StaticServlet.returnFile: getOutputStream failed",
       log4jLog.log.toString());
   TestUtil.deleteTree("_test_");
 }
예제 #5
0
 public void test_returnFile_sendFileData() {
   TestUtil.writeFile("_test_", "Sample file to return.");
   StaticServlet.returnFile("_test_", context, response);
   assertEquals("information returned", "Sample file to return.", response.toString());
   TestUtil.deleteTree("_test_");
 }