[255] | 1 | package de.ugoe.cs.util;
|
---|
| 2 |
|
---|
| 3 | import org.junit.*;
|
---|
| 4 | import 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 | */
|
---|
| 13 | public 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&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"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'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<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>bc", result);
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | @Test
|
---|
| 61 | public void testXmlEntityReplacement_7() throws Exception {
|
---|
| 62 | String str = "a&bc";
|
---|
| 63 | String result = StringTools.xmlEntityReplacement(str);
|
---|
| 64 | assertEquals("a&bc", result);
|
---|
| 65 | }
|
---|
| 66 |
|
---|
| 67 | @Test
|
---|
| 68 | public void testXmlEntityReplacement_8() throws Exception {
|
---|
| 69 | String str = "a"bc";
|
---|
| 70 | String result = StringTools.xmlEntityReplacement(str);
|
---|
| 71 | assertEquals("a"bc", result);
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | @Test
|
---|
| 75 | public void testXmlEntityReplacement_9() throws Exception {
|
---|
| 76 | String str = "a'bc";
|
---|
| 77 | String result = StringTools.xmlEntityReplacement(str);
|
---|
| 78 | assertEquals("a'bc", result);
|
---|
| 79 | }
|
---|
| 80 |
|
---|
| 81 | @Test
|
---|
| 82 | public void testXmlEntityReplacement_10() throws Exception {
|
---|
| 83 | String str = "a<bc";
|
---|
| 84 | String result = StringTools.xmlEntityReplacement(str);
|
---|
| 85 | assertEquals("a<bc", result);
|
---|
| 86 | }
|
---|
| 87 |
|
---|
| 88 | @Test
|
---|
| 89 | public void testXmlEntityReplacement_11() throws Exception {
|
---|
| 90 | String str = "a>bc";
|
---|
| 91 | String result = StringTools.xmlEntityReplacement(str);
|
---|
| 92 | assertEquals("a>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&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&b&c", result);
|
---|
| 107 | }
|
---|
[352] | 108 |
|
---|
| 109 | @Test
|
---|
| 110 | public void testXmlEntityReplacement_14() throws Exception {
|
---|
| 111 | String str = "";
|
---|
| 112 | String result = StringTools.xmlEntityReplacement(str);
|
---|
| 113 | assertEquals("", result);
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | @Test
|
---|
| 117 | public void testXmlEntityReplacement_15() throws Exception {
|
---|
| 118 | String str = null;
|
---|
| 119 | String result = StringTools.xmlEntityReplacement(str);
|
---|
| 120 | assertNull(result);
|
---|
| 121 | }
|
---|
[255] | 122 |
|
---|
| 123 | @Before
|
---|
| 124 | public void setUp() throws Exception {
|
---|
| 125 | // add additional set up code here
|
---|
| 126 | }
|
---|
| 127 |
|
---|
| 128 | @After
|
---|
| 129 | public void tearDown() throws Exception {
|
---|
| 130 | // Add additional tear down code here
|
---|
| 131 | }
|
---|
| 132 |
|
---|
| 133 | public static void main(String[] args) {
|
---|
| 134 | new org.junit.runner.JUnitCore().run(StringToolsTest.class);
|
---|
| 135 | }
|
---|
| 136 | } |
---|