KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > info > magnolia > cms > taglibs > util > SearchResultSnippetTagTest


1 package info.magnolia.cms.taglibs.util;
2
3 import junit.framework.TestCase;
4
5
6 /**
7  * @author fgiust
8  * @version $Revision: 6606 $ ($Author: fgiust $)
9  */

10 public class SearchResultSnippetTagTest extends TestCase {
11
12     public void testStripHtmlSimple() {
13         String JavaDoc html = "<div>uh!</div>";
14         String JavaDoc text = "uh!";
15         String JavaDoc result = new SearchResultSnippetTag().stripHtmlTags(html);
16         assertEquals(text, result);
17     }
18
19     public void testStripHtmlEmptyTag() {
20         String JavaDoc html = "<div>uh!<br/></div>";
21         String JavaDoc text = "uh!";
22         String JavaDoc result = new SearchResultSnippetTag().stripHtmlTags(html);
23         assertEquals(text, result);
24     }
25
26     public void testStripHtmlNewLines() {
27         String JavaDoc html = "<div\n class=\"abc\">uh!</div>";
28         String JavaDoc text = "uh!";
29         String JavaDoc result = new SearchResultSnippetTag().stripHtmlTags(html);
30         assertEquals(text, result);
31     }
32
33     public void testStripHtmlMultipleNewLines() {
34         String JavaDoc html = "<div\n class=\"abc\"\n style=\"abc\">uh!</div>";
35         String JavaDoc text = "uh!";
36         String JavaDoc result = new SearchResultSnippetTag().stripHtmlTags(html);
37         assertEquals(text, result);
38     }
39
40     public void testStripHtmlNewLineAsLast() {
41         String JavaDoc html = "<div\n class=\"abc\"\n style=\"abc\"\n>uh!</div>";
42         String JavaDoc text = "uh!";
43         String JavaDoc result = new SearchResultSnippetTag().stripHtmlTags(html);
44         assertEquals(text, result);
45     }
46 }
47
Popular Tags