1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.util; |
21 |
|
|
22 |
|
import org.junit.Assert; |
23 |
|
import org.junit.Test; |
24 |
|
|
25 |
|
|
26 |
|
@link |
27 |
|
|
28 |
|
@version |
29 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (28) |
Complexity: 3 |
Complexity Density: 0.12 |
|
30 |
|
public class UtilTest |
31 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
32 |
1 |
@Test... |
33 |
|
public void testConvertToAlphaNumeric() |
34 |
|
{ |
35 |
1 |
Assert.assertEquals("Search", Util.convertToAlphaNumeric("Search")); |
36 |
1 |
Assert.assertEquals("Search", Util.convertToAlphaNumeric("S.earch")); |
37 |
1 |
Assert.assertEquals("e", Util.convertToAlphaNumeric("e$%\u00a3#^()")); |
38 |
1 |
Assert.assertEquals("e", Util.convertToAlphaNumeric(":\u0205!")); |
39 |
|
} |
40 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 1 |
Complexity Density: 0.08 |
1PASS
|
|
41 |
1 |
@Test... |
42 |
|
public void testIsValidXMLElementName() |
43 |
|
{ |
44 |
1 |
Assert.assertTrue(Util.isValidXMLElementName("myprop")); |
45 |
1 |
Assert.assertTrue(Util.isValidXMLElementName("my_prop")); |
46 |
1 |
Assert.assertTrue(Util.isValidXMLElementName("my_prop-1")); |
47 |
1 |
Assert.assertTrue(Util.isValidXMLElementName("my_prop-1.1")); |
48 |
1 |
Assert.assertFalse(Util.isValidXMLElementName("ns:my_prop-1")); |
49 |
1 |
Assert.assertFalse(Util.isValidXMLElementName("1prop")); |
50 |
1 |
Assert.assertFalse(Util.isValidXMLElementName("xmlprop")); |
51 |
1 |
Assert.assertFalse(Util.isValidXMLElementName("XMLprop")); |
52 |
1 |
Assert.assertFalse(Util.isValidXMLElementName("xMLprop")); |
53 |
1 |
Assert.assertFalse(Util.isValidXMLElementName("Xmlprop")); |
54 |
1 |
Assert.assertFalse(Util.isValidXMLElementName("ns my_prop")); |
55 |
1 |
Assert.assertFalse(Util.isValidXMLElementName("ns,my_prop")); |
56 |
|
} |
57 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (9) |
Complexity: 1 |
Complexity Density: 0.11 |
1PASS
|
|
58 |
1 |
@Test... |
59 |
|
public void testNormalizeLanguage() |
60 |
|
{ |
61 |
1 |
Assert.assertNull(Util.normalizeLanguage(null)); |
62 |
1 |
Assert.assertEquals("", Util.normalizeLanguage("")); |
63 |
1 |
Assert.assertEquals("", Util.normalizeLanguage(" ")); |
64 |
1 |
Assert.assertEquals("default", Util.normalizeLanguage("default")); |
65 |
1 |
Assert.assertEquals("default", Util.normalizeLanguage("DeFault")); |
66 |
1 |
Assert.assertEquals("default", Util.normalizeLanguage("invalid code")); |
67 |
1 |
Assert.assertEquals("en", Util.normalizeLanguage("en")); |
68 |
1 |
Assert.assertEquals("en", Util.normalizeLanguage("En_")); |
69 |
1 |
Assert.assertEquals("de_AT", Util.normalizeLanguage("DE_at")); |
70 |
|
} |
71 |
|
} |