source: trunk/JavaHelperLibTest/src/de/ugoe/cs/util/StringToolsTest.java @ 255

Last change on this file since 255 was 255, checked in by sherbold, 13 years ago
  • Property svn:mime-type set to text/plain
File size: 3.1 KB
Line 
1package de.ugoe.cs.util;
2
3import org.junit.*;
4import static org.junit.Assert.*;
5
6/**
7 * The class <code>StringToolsTest</code> contains tests for the class
8 * <code>{@link StringTools}</code>.
9 *
10 * @author Steffen Herbold
11 * @version 1.0
12 */
13public class StringToolsTest {
14
15        @Test
16        public void testXmlEntityReplacement_1() throws Exception {
17                String str = "abc";
18
19                String result = StringTools.xmlEntityReplacement(str);
20
21                // add additional test code here
22                assertEquals("abc", result);
23        }
24
25        @Test
26        public void testXmlEntityReplacement_2() throws Exception {
27                String str = "a&bc";
28                String result = StringTools.xmlEntityReplacement(str);
29                assertEquals("a&amp;bc", result);
30        }
31
32        @Test
33        public void testXmlEntityReplacement_3() throws Exception {
34                String str = "a\"bc";
35                String result = StringTools.xmlEntityReplacement(str);
36                assertEquals("a&quot;bc", result);
37        }
38
39        @Test
40        public void testXmlEntityReplacement_4() throws Exception {
41                String str = "a'bc";
42                String result = StringTools.xmlEntityReplacement(str);
43                assertEquals("a&apos;bc", result);
44        }
45
46        @Test
47        public void testXmlEntityReplacement_5() throws Exception {
48                String str = "a<bc";
49                String result = StringTools.xmlEntityReplacement(str);
50                assertEquals("a&lt;bc", result);
51        }
52
53        @Test
54        public void testXmlEntityReplacement_6() throws Exception {
55                String str = "a>bc";
56                String result = StringTools.xmlEntityReplacement(str);
57                assertEquals("a&gt;bc", result);
58        }
59
60        @Test
61        public void testXmlEntityReplacement_7() throws Exception {
62                String str = "a&amp;bc";
63                String result = StringTools.xmlEntityReplacement(str);
64                assertEquals("a&amp;bc", result);
65        }
66
67        @Test
68        public void testXmlEntityReplacement_8() throws Exception {
69                String str = "a&quot;bc";
70                String result = StringTools.xmlEntityReplacement(str);
71                assertEquals("a&quot;bc", result);
72        }
73
74        @Test
75        public void testXmlEntityReplacement_9() throws Exception {
76                String str = "a&apos;bc";
77                String result = StringTools.xmlEntityReplacement(str);
78                assertEquals("a&apos;bc", result);
79        }
80
81        @Test
82        public void testXmlEntityReplacement_10() throws Exception {
83                String str = "a&lt;bc";
84                String result = StringTools.xmlEntityReplacement(str);
85                assertEquals("a&lt;bc", result);
86        }
87
88        @Test
89        public void testXmlEntityReplacement_11() throws Exception {
90                String str = "a&gt;bc";
91                String result = StringTools.xmlEntityReplacement(str);
92                assertEquals("a&gt;bc", result);
93        }
94
95        @Test
96        public void testXmlEntityReplacement_12() throws Exception {
97                String str = "a&foo;bc";
98                String result = StringTools.xmlEntityReplacement(str);
99                assertEquals("a&amp;foo;bc", result);
100        }
101
102        @Test
103        public void testXmlEntityReplacement_13() throws Exception {
104                String str = "a&b&c";
105                String result = StringTools.xmlEntityReplacement(str);
106                assertEquals("a&amp;b&amp;c", result);
107        }
108
109        @Before
110        public void setUp() throws Exception {
111                // add additional set up code here
112        }
113
114        @After
115        public void tearDown() throws Exception {
116                // Add additional tear down code here
117        }
118
119        public static void main(String[] args) {
120                new org.junit.runner.JUnitCore().run(StringToolsTest.class);
121        }
122}
Note: See TracBrowser for help on using the repository browser.