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
19
20
21
22 public class DumpLinksTest extends TestCase {
23
24
25
26
27 public DumpLinksTest(String name) {
28 super(name);
29 }
30
31
32
33
34
35 protected void setUp() throws Exception {
36 super.setUp();
37 }
38
39
40
41
42
43 protected void tearDown() throws Exception {
44 super.tearDown();
45 }
46
47
48
49
50 public void testVisitTag() {
51
52 }
53
54
55
56
57 public void testFinish() {
58
59 }
60
61
62
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
78 assertEquals("r1" +
79 System.getProperty("line.separator") +
80 "r2" +
81 System.getProperty("line.separator") ,
82 o.toString());
83
84 }
85
86
87
88
89 public void testDumpLinksOutputStreamString() {
90
91 }
92
93
94
95
96 public void testMain() {
97
98 }
99
100 }