Example #1
0
 public void test_init_absolutePath() throws ServletException {
   String os = System.getProperty("os.name");
   if (os.startsWith("Windows")) {
     config.parameterValue = "C:/Temp";
   } else {
     config.parameterValue = "/abc/def";
   }
   servlet.init(config);
   assertEquals("prefix value", config.parameterValue, servlet.prefix);
 }
Example #2
0
  public void setUp() throws ServletException {
    // Set up a StaticServlet, along with its context and config.
    context = new ServletContextFixture();
    config = new ServletConfigFixture(context);
    servlet = new StaticServlet();
    servlet.init(config);
    response = new ServletResponseFixture();

    // Redirect the servlet's log so we can read any output
    // generated.
    log4jLog = new StringAppender();
    StaticServlet.logger = Logger.getRootLogger();
    StaticServlet.logger.removeAllAppenders();
    StaticServlet.logger.addAppender(log4jLog);
  }
Example #3
0
 public void test_init_noBaseParameter() throws ServletException {
   config.parameterValue = null;
   servlet.init(config);
   assertEquals("prefix value", "test/testData/static", servlet.prefix);
 }
Example #4
0
 public void test_init_relativePath() throws ServletException {
   config.parameterValue = "x/y/z";
   servlet.init(config);
   assertEquals("prefix value", "test/testData/x/y/z", servlet.prefix);
 }