1
2
3
4 package com.quiotix.html.parser.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 junit.framework.TestCase;
12
13 import com.quiotix.html.parser.HtmlCollector;
14 import com.quiotix.html.parser.HtmlDocument;
15 import com.quiotix.html.parser.HtmlFormatter;
16 import com.quiotix.html.parser.HtmlParser;
17 import com.quiotix.html.parser.HtmlScrubber;
18
19
20
21
22
23
24 public class HtmlFormatterTest extends TestCase {
25
26
27
28
29 public HtmlFormatterTest(String name) {
30 super(name);
31 }
32
33
34
35
36
37 protected void setUp() throws Exception {
38 super.setUp();
39 }
40
41
42
43
44
45 protected void tearDown() throws Exception {
46 super.tearDown();
47 }
48
49
50
51
52 public void testVisitTag() {
53
54 }
55
56
57
58
59 public void testVisitEndTag() {
60
61 }
62
63
64
65
66 public void testVisitComment() {
67
68 }
69
70
71
72
73 public void testVisitText() {
74
75 }
76
77
78
79
80 public void testVisitNewline() {
81
82 }
83
84
85
86
87 public void testVisitTagBlock() {
88
89 }
90
91
92
93
94 public void testStart() {
95
96 }
97
98
99
100
101 public void testFinish() {
102
103 }
104
105
106
107
108 public void testHtmlFormatterTRIM_SPACES() throws Exception {
109 String testString = "<html><head><BODy><P class=unquoted>Hi test " +
110 System.getProperty("line.separator") +
111 "<p> Spaces preserved at back but not at front ";
112 InputStream r = new ByteArrayInputStream(testString.getBytes());
113 OutputStream o = new ByteArrayOutputStream();
114 HtmlDocument document;
115
116 document = new HtmlParser(r).HtmlDocument();
117 document.accept(new HtmlScrubber(HtmlScrubber.DEFAULT_OPTIONS
118 | HtmlScrubber.TRIM_SPACES));
119 document.accept(new HtmlCollector());
120 document.accept(new HtmlFormatter(o));
121 assertEquals("<html><head><body>" +
122 System.getProperty("line.separator") +
123 "<p class=\"unquoted\">Hi test " +
124 System.getProperty("line.separator") +
125 "<p>Spaces preserved at back but not at front " , o.toString());
126 }
127
128
129
130 public void testHtmlFormatter() throws Exception {
131 String testString = "<html><head><BODy><P class=unquoted>Hi test " +
132 System.getProperty("line.separator") +
133 "<p> Spaces preserved ";
134 InputStream r = new ByteArrayInputStream(testString.getBytes());
135 OutputStream o = new ByteArrayOutputStream();
136 HtmlDocument document;
137
138 document = new HtmlParser(r).HtmlDocument();
139 document.accept(new HtmlScrubber(HtmlScrubber.DEFAULT_OPTIONS));
140 document.accept(new HtmlCollector());
141 document.accept(new HtmlFormatter(o));
142 assertEquals("<html><head><body>" +
143 System.getProperty("line.separator") +
144 "<p class=\"unquoted\">Hi test " +
145 System.getProperty("line.separator") +
146 "<p> Spaces preserved " , o.toString());
147 }
148
149
150
151
152 public void testSetRightMargin() {
153
154 }
155
156
157
158
159 public void testSetIndent() {
160
161 }
162
163
164
165
166 public void testMain() {
167 }
168
169 }