1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 package net.fckeditor.tool;
22
23 import static org.junit.Assert.*;
24
25 import org.junit.Test;
26
27
28
29
30
31
32 public class XHtmlTagToolTest {
33
34 @Test
35 public void testClosingTag01() throws Exception {
36 XHtmlTagTool tag = new XHtmlTagTool("test");
37 assertEquals("<test />", tag.toString());
38 }
39
40 @Test
41 public void testClosingTag02() throws Exception {
42 XHtmlTagTool tag = new XHtmlTagTool("test", "");
43 assertEquals("<test />", tag.toString());
44 }
45
46 @Test
47 public void testClosingTag03() throws Exception {
48 XHtmlTagTool tag = new XHtmlTagTool("test", "val");
49 assertEquals("<test>val</test>", tag.toString());
50 }
51
52 @Test
53 public void testClosingTag04() throws Exception {
54 XHtmlTagTool tag = new XHtmlTagTool("test", XHtmlTagTool.SPACE);
55 assertEquals("<test> </test>", tag.toString());
56 }
57
58 @Test
59 public void deepEquals01() throws Exception {
60 XHtmlTagTool expected = new XHtmlTagTool("tag", "some text");
61 XHtmlTagTool actual = new XHtmlTagTool("tag", "some text");
62 assertEquals(expected, actual);
63 }
64
65 @Test
66 public void deepEquals02() throws Exception {
67 XHtmlTagTool unexpected = new XHtmlTagTool("tag", "");
68 XHtmlTagTool actual = new XHtmlTagTool("tag", XHtmlTagTool.SPACE);
69 assertNotSame(unexpected, actual);
70 }
71
72 @Test
73 public void deepEquals03() throws Exception {
74 XHtmlTagTool expected = new XHtmlTagTool("tag", "some text");
75 expected.addAttribute("id", "some_tag_id");
76 expected.addAttribute("class", "grayShadow");
77 expected.addAttribute("style", "color: red");
78
79 XHtmlTagTool actual = new XHtmlTagTool("tag", "some text");
80
81 actual.addAttribute("style", "color: red");
82 actual.addAttribute("id", "some_tag_id");
83 actual.addAttribute("class", "grayShadow");
84
85 assertEquals(expected, actual);
86 }
87
88 @Test
89 public void deepEquals04() throws Exception {
90 XHtmlTagTool unexpected = new XHtmlTagTool("tag");
91 unexpected.addAttribute("id", "some_tag_id");
92 unexpected.addAttribute("class", "grayShadow");
93 unexpected.addAttribute("style", "color: red");
94
95 XHtmlTagTool actual = new XHtmlTagTool("tag");
96
97 actual.addAttribute("id", "some_tag_id");
98 actual.addAttribute("class", "grayShadow");
99 actual.addAttribute("style", "color: blue");
100
101 assertNotSame(unexpected, actual);
102 }
103 }