1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.component.internal.namespace; |
21 |
|
|
22 |
|
import org.junit.Test; |
23 |
|
import org.xwiki.component.namespace.Namespace; |
24 |
|
import org.xwiki.component.namespace.NamespaceUtils; |
25 |
|
|
26 |
|
import static org.junit.Assert.assertEquals; |
27 |
|
|
28 |
|
|
29 |
|
@link |
30 |
|
|
31 |
|
@version |
32 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 2 |
Complexity Density: 0.2 |
|
33 |
|
public class NamespaceUtilsTest |
34 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
35 |
1 |
@Test... |
36 |
|
public void getPrefix() |
37 |
|
{ |
38 |
1 |
assertEquals(null, NamespaceUtils.getPrefix(null)); |
39 |
1 |
assertEquals(null, NamespaceUtils.getPrefix("namespace")); |
40 |
1 |
assertEquals("type", NamespaceUtils.getPrefix("type:value")); |
41 |
1 |
assertEquals("t:pe", NamespaceUtils.getPrefix("t\\:pe:value")); |
42 |
1 |
assertEquals("", NamespaceUtils.getPrefix(":value")); |
43 |
|
} |
44 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
1PASS
|
|
45 |
1 |
@Test... |
46 |
|
public void toNamespace() |
47 |
|
{ |
48 |
1 |
assertEquals(null, NamespaceUtils.toNamespace(null)); |
49 |
1 |
assertEquals(new Namespace(null, "namespace"), NamespaceUtils.toNamespace("namespace")); |
50 |
1 |
assertEquals(new Namespace("type", "value"), NamespaceUtils.toNamespace("type:value")); |
51 |
1 |
assertEquals(new Namespace("t:pe", "val\\ue"), NamespaceUtils.toNamespace("t\\:pe:val\\ue")); |
52 |
1 |
assertEquals(new Namespace("", "value"), NamespaceUtils.toNamespace(":value")); |
53 |
|
} |
54 |
|
} |