1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.web; |
21 |
|
|
22 |
|
import java.io.IOException; |
23 |
|
|
24 |
|
import org.jmock.cglib.MockObjectTestCase; |
25 |
|
|
26 |
|
|
27 |
|
@link |
28 |
|
|
29 |
|
@version |
30 |
|
|
|
|
| 81.1% |
Uncovered Elements: 7 (37) |
Complexity: 16 |
Complexity Density: 0.57 |
|
31 |
|
public class SkinActionTest extends MockObjectTestCase |
32 |
|
{ |
33 |
|
private SkinAction action; |
34 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
35 |
8 |
@Override... |
36 |
|
protected void setUp() |
37 |
|
{ |
38 |
8 |
this.action = new SkinAction(); |
39 |
|
} |
40 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
41 |
1 |
public void testIsTextJavascriptJavaScriptMimetype()... |
42 |
|
{ |
43 |
1 |
assertTrue(this.action.isJavascriptMimeType("text/javascript")); |
44 |
|
} |
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
46 |
1 |
public void testIsApplicationJavascriptJavaScriptMimetype()... |
47 |
|
{ |
48 |
1 |
assertTrue(this.action.isJavascriptMimeType("application/javascript")); |
49 |
|
} |
50 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
51 |
1 |
public void testIsApplicationXJavascriptJavaScriptMimetype()... |
52 |
|
{ |
53 |
1 |
assertTrue(this.action.isJavascriptMimeType("application/x-javascript")); |
54 |
|
} |
55 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
56 |
1 |
public void testIsTextEcmascriptJavaScriptMimetype()... |
57 |
|
{ |
58 |
1 |
assertTrue(this.action.isJavascriptMimeType("text/ecmascript")); |
59 |
|
} |
60 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
61 |
1 |
public void testIsApplicationEcmascriptJavaScriptMimetype()... |
62 |
|
{ |
63 |
1 |
assertTrue(this.action.isJavascriptMimeType("application/ecmascript")); |
64 |
|
} |
65 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
66 |
1 |
public void testNPEJavascriptMimetype()... |
67 |
|
{ |
68 |
1 |
assertFalse(this.action.isJavascriptMimeType(null)); |
69 |
|
} |
70 |
|
|
|
|
| 66.7% |
Uncovered Elements: 4 (12) |
Complexity: 5 |
Complexity Density: 0.42 |
1PASS
|
|
71 |
1 |
public void testIncorrectSkinFile()... |
72 |
|
{ |
73 |
1 |
try { |
74 |
1 |
this.action.getSkinFilePath("../../resources/js/xwiki/xwiki.js", "colibri"); |
75 |
0 |
assertTrue("should fail", false); |
76 |
|
} catch (IOException e) { |
77 |
|
|
78 |
|
} |
79 |
1 |
try { |
80 |
1 |
this.action.getSkinFilePath("../../../", "colibri"); |
81 |
0 |
assertTrue("should fail", false); |
82 |
|
} catch (IOException e) { |
83 |
|
|
84 |
|
} |
85 |
1 |
try { |
86 |
1 |
this.action.getSkinFilePath("resources/js/xwiki/xwiki.js", ".."); |
87 |
0 |
assertTrue("should fail", false); |
88 |
|
} catch (IOException e) { |
89 |
|
|
90 |
|
} |
91 |
1 |
try { |
92 |
1 |
this.action.getSkinFilePath("../resources/js/xwiki/xwiki.js", "."); |
93 |
0 |
assertTrue("should fail", false); |
94 |
|
} catch (IOException e) { |
95 |
|
|
96 |
|
} |
97 |
|
} |
98 |
|
|
|
|
| 66.7% |
Uncovered Elements: 3 (9) |
Complexity: 4 |
Complexity Density: 0.44 |
1PASS
|
|
99 |
1 |
public void testIncorrectResourceFile()... |
100 |
|
{ |
101 |
1 |
try { |
102 |
1 |
this.action.getResourceFilePath("../../skins/js/xwiki/xwiki.js"); |
103 |
0 |
assertTrue("should fail", false); |
104 |
|
} catch (IOException e) { |
105 |
|
|
106 |
|
} |
107 |
1 |
try { |
108 |
1 |
this.action.getResourceFilePath("../../../"); |
109 |
0 |
assertTrue("should fail", false); |
110 |
|
} catch (IOException e) { |
111 |
|
|
112 |
|
} |
113 |
1 |
try { |
114 |
1 |
this.action.getResourceFilePath("../../redirect"); |
115 |
0 |
assertTrue("should fail", false); |
116 |
|
} catch (IOException e) { |
117 |
|
|
118 |
|
} |
119 |
|
} |
120 |
|
} |