KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ajaxtags > test > HtmlHelperTest


1 /**
2  * Copyright 2007 Jens Kapitza
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.ajaxtags.test;
17
18 import static junit.framework.Assert.*;
19
20 import org.ajaxtags.helpers.AjaxHtmlHelper;
21 import org.junit.Before;
22 import org.junit.Test;
23
24 /**
25  * Simple Testcase for AjaxHtmlHelper
26  *
27  * @author Jens Kapitza
28  * @version $Revision: 1.2 $ $Date: 2007/07/22 16:29:16 $ $Author: jenskapitza $
29  */

30 public class HtmlHelperTest {
31
32     private String JavaDoc html;
33     private String JavaDoc tagcontent, tagcontentdiv;
34
35     /**
36      * setup the vars
37      */

38     @Before
39     public void setUp() {
40         this.tagcontent = "das ist ein test";
41         this.tagcontentdiv = this.tagcontent + " DIV";
42         this.html = "<html><body><div class='klasse' id='id'>"
43                 + this.tagcontentdiv + "</div><a>" + this.tagcontent
44                 + "</a></body></html>";
45     }
46
47     /**
48      * test if helper find the right stuff
49      */

50     @Test
51     public void tagContent() {
52         assertEquals(AjaxHtmlHelper.getTagContent(this.html, "a"),
53                 this.tagcontent);
54         assertEquals(AjaxHtmlHelper.getTagContent(this.html, "div", "klasse"),
55                 this.tagcontentdiv);
56         assertEquals(AjaxHtmlHelper.getTagContentById(this.html, "id"),
57                 this.tagcontentdiv);
58     }
59
60 }
61
Popular Tags