1   /**
2    * 
3    */
4   package com.quiotix.html.example.test;
5   
6   import java.io.ByteArrayInputStream;
7   import java.io.ByteArrayOutputStream;
8   import java.io.InputStream;
9   import java.io.OutputStream;
10  
11  import com.quiotix.html.example.DumpLinks;
12  import com.quiotix.html.parser.HtmlDocument;
13  import com.quiotix.html.parser.HtmlParser;
14  
15  import junit.framework.TestCase;
16  
17  /**
18   * @author timp
19   * @since 19 Nov 2007
20   *
21   */
22  public class DumpLinksTest extends TestCase {
23  
24      /**
25       * @param name
26       */
27      public DumpLinksTest(String name) {
28          super(name);
29      }
30  
31      /** 
32       * {@inheritDoc}
33       * @see junit.framework.TestCase#setUp()
34       */
35      protected void setUp() throws Exception {
36          super.setUp();
37      }
38  
39      /** 
40       * {@inheritDoc}
41       * @see junit.framework.TestCase#tearDown()
42       */
43      protected void tearDown() throws Exception {
44          super.tearDown();
45      }
46  
47      /**
48       * Test method for {@link com.quiotix.html.example.DumpLinks#visit(com.quiotix.html.parser.HtmlDocument.Tag)}.
49       */
50      public void testVisitTag() {
51          
52      }
53  
54      /**
55       * Test method for {@link com.quiotix.html.example.DumpLinks#finish()}.
56       */
57      public void testFinish() {
58          
59      }
60  
61      /**
62       * Test method for {@link com.quiotix.html.example.DumpLinks#DumpLinks(java.io.OutputStream)}.
63       */
64      public void testDumpLinksOutputStream() throws Exception {
65          HtmlDocument document;
66  
67          String testString = "<html><head><BODy><P class=unquoted>Hi test  " + 
68          System.getProperty("line.separator") +
69          "<a href='r1'>ref1<a>" +
70          System.getProperty("line.separator") +
71          "<a href='r2'>ref2<a>";
72          InputStream r = new ByteArrayInputStream(testString.getBytes());
73          OutputStream o = new ByteArrayOutputStream();
74  
75          document = new HtmlParser(r).HtmlDocument();
76          document.accept(new DumpLinks(o));
77          //System.err.println(o.toString());
78          assertEquals("r1" + 
79                  System.getProperty("line.separator") + 
80                  "r2" +
81                  System.getProperty("line.separator") , 
82                  o.toString());
83          
84      }
85  
86      /**
87       * Test method for {@link com.quiotix.html.example.DumpLinks#DumpLinks(java.io.OutputStream, java.lang.String)}.
88       */
89      public void testDumpLinksOutputStreamString() {
90          
91      }
92  
93      /**
94       * Test method for {@link com.quiotix.html.example.DumpLinks#main(java.lang.String[])}.
95       */
96      public void testMain() {
97          
98      }
99  
100 }