1   /*
2    * Created on 26.09.2004
3    *
4    */
5   package org.w3c.tidy.servlet;
6   
7   import com.meterware.httpunit.WebResponse;
8   
9   import org.w3c.tidy.servlet.Consts;
10  
11  /***
12   *
13   * @author Vlad Skarzhevskyy <a href="mailto:skarzhevskyy@gmail.com">skarzhevskyy@gmail.com</a>
14   * @version $Revision: 1.2 $ ($Author: vlads $)
15   */
16  public class ReportsSourceTest extends TidyServletCase {
17  
18      /***
19       * Instantiates a new test case.
20       * @param name test name
21       */
22      public ReportsSourceTest(String name)
23      {
24          super(name);
25      }
26  
27      public void testSourceResult() throws Exception
28      {
29      	WebResponse response =  getJSPResponse("servlet/FormatedByTagOK.jsp");
30  
31          String requestID1 = response.getNewCookieValue(Consts.ATTRIBUTE_REQUEST_ID);
32          
33          WebResponse reportResponse =  getResponseQuery(new String[] {"requestID", requestID1});
34  
35          //assertEquals("Messages exists exists", 1, reportResponse.getElementsWithName("JTidyMessagesTable").length);
36          assertTrue("Messages exists exists", reportResponse.getText().indexOf("JTidyMessagesTable") > 0);
37          //assertEquals("Result Source code exists", 1, reportResponse.getElementsWithName("JTidyHtmlResult").length);
38          assertTrue("Result Source code exists", reportResponse.getText().indexOf("JTidyHtmlResult") > 0);
39          //assertEquals("Source code exists", 0, reportResponse.getElementsWithName("JTidyOriginalSource").length);
40          assertTrue("Source code not exists", reportResponse.getText().indexOf("JTidyOriginalSource") == -1);
41      }
42  }