1 | void testRemoveComments1() {↵ | | 1 | void testRemoveComments2() {↵
|
2 | String input = "<html><body><p><!- this is a text without comments -></p></body></html>";↵ | | 2 | String input = "<html><body><p><!-- this is a comment -->And some text</p></body></html>";↵
|
3 | String result = HtmlParser.removeComments(input);↵ | | 3 | String result = HtmlParser.removeComments(input);↵
|
4 | assertTrue(result↵ | | 4 | assertTrue(result↵
|
5 | .equals("<html><body><p><!- this is a text without comments -></p></body></html>"));↵ | | 5 | .equals("<html><body><p>And some text</p></body></html>"));↵
|
6 | }↵ | | 6 | }↵
|
|
7 | public void testRemoveComments2() {↵ | | 7 | public void testRemoveComments3() {↵
|
8 | String input = "<html><body><p><!-- this is a comment -->And some text↵ | | 8 | String input = "<html><body><p><!-- this is a comment \n"↵
|
| | | 9 | + "\t\twhich is spread over \n"↵
|
| | | 10 | + " multiple lines-->And some text</p> \n\n"↵
|
| | | 11 | + "<h1>A header </h><!-- a little comment --><p>"↵
|
9 | </p></body></html>";↵ | | 12 | + "<i>The end</i></p></body></html>";↵
|
10 | String result = HtmlParser.removeComments(input);↵ | | 13 | String result = HtmlParser.removeComments(input);↵
|
11 | assertTrue(result↵ | | 14 | assertTrue(result↵
|
12 | .equals("<html><body><p>And some text</p>↵ | | 15 | .equals("<html><body><p>And some text</p> \n\n"↵
|
13 | </body></html>"));↵ | | 16 | + "<h1>A header </h><p>" + "<i>The end</i></p></body></html>"));↵
|
14 | | | 17 |
|