コード例 #1
0
ファイル: TooltipTest.java プロジェクト: ChenLinXi/struts
 /** @throws Exception */
 public void setUp() throws Exception {
   super.setUp();
   initDispatcher(
       new HashMap<String, String>() {
         {
           put("configProviders", TestConfigurationProvider.class.getName());
         }
       });
   createMocks();
 }
コード例 #2
0
  public void testPlainTextWithoutSlash() throws Exception {
    PlainTextResult result = new PlainTextResult();
    result.setLocation("someJspFile.jsp");

    response.setExpectedContentType("text/plain");
    response.setExpectedHeader("Content-Disposition", "inline");
    InputStream jspResourceInputStream =
        ClassLoaderUtil.getResourceAsStream(
            "org/apache/struts2/dispatcher/someJspFile.jsp", PlainTextResultTest.class);

    try {
      servletContext.setResourceAsStream(jspResourceInputStream);
      result.execute(invocation);

      String r = AbstractUITagTest.normalize(stringWriter.getBuffer().toString(), true);
      String e =
          AbstractUITagTest.normalize(
              readAsString("org/apache/struts2/dispatcher/someJspFile.jsp"), true);
      assertEquals(r, e);
    } finally {
      jspResourceInputStream.close();
    }
  }