1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package org.xwiki.vfs.internal; |
21 |
|
|
22 |
|
import java.net.URI; |
23 |
|
|
24 |
|
import org.junit.Test; |
25 |
|
import org.xwiki.vfs.VfsResourceReference; |
26 |
|
|
27 |
|
import static org.junit.Assert.*; |
28 |
|
|
29 |
|
|
30 |
|
@link |
31 |
|
|
32 |
|
@version |
33 |
|
@since |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (20) |
Complexity: 4 |
Complexity Density: 0.25 |
|
35 |
|
public class VfsResourceReferenceTest |
36 |
|
{ |
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
37 |
1 |
@Test... |
38 |
|
public void constructor() |
39 |
|
{ |
40 |
1 |
VfsResourceReference reference = new VfsResourceReference( |
41 |
|
URI.create("attach:Sandbox.WebHome@my.zip/path/to/file")); |
42 |
1 |
assertEquals("attach:Sandbox.WebHome@my.zip", reference.getURI().toString()); |
43 |
1 |
assertEquals("path/to/file", reference.getPath()); |
44 |
|
} |
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 1 |
Complexity Density: 0.14 |
1PASS
|
|
46 |
1 |
@Test... |
47 |
|
public void equality() |
48 |
|
{ |
49 |
1 |
VfsResourceReference reference1 = |
50 |
|
new VfsResourceReference(URI.create("scheme:specific"), "a/b"); |
51 |
1 |
reference1.addParameter("key", "value"); |
52 |
1 |
VfsResourceReference reference2 = |
53 |
|
new VfsResourceReference(URI.create("scheme:specific"), "a/b"); |
54 |
|
|
55 |
1 |
assertNotEquals(reference1, reference2); |
56 |
|
|
57 |
1 |
reference2.addParameter("key", "value"); |
58 |
1 |
assertEquals(reference1, reference2); |
59 |
1 |
assertEquals(reference1.hashCode(), reference2.hashCode()); |
60 |
|
} |
61 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
62 |
1 |
@Test... |
63 |
|
public void toURI() |
64 |
|
{ |
65 |
1 |
VfsResourceReference reference = |
66 |
|
new VfsResourceReference(URI.create("scheme:specific"), "a/b"); |
67 |
|
|
68 |
1 |
URI expected = URI.create("scheme:specific/a/b"); |
69 |
1 |
assertEquals(expected, reference.toURI()); |
70 |
|
} |
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
1PASS
|
|
72 |
1 |
@Test... |
73 |
|
public void stringValue() |
74 |
|
{ |
75 |
1 |
VfsResourceReference reference = |
76 |
|
new VfsResourceReference(URI.create("scheme:specific"), "a/b"); |
77 |
1 |
reference.addParameter("key", "value"); |
78 |
1 |
assertEquals("uri = [scheme:specific], path = [a/b], parameters = [[key] = [[value]]]", reference.toString()); |
79 |
|
} |
80 |
|
} |