| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package org.xwiki.rendering.wikimodel; |
| 21 |
|
|
| 22 |
|
import junit.framework.TestCase; |
| 23 |
|
|
| 24 |
|
|
| 25 |
|
@version |
| 26 |
|
@since |
| 27 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (13) |
Complexity: 3 |
Complexity Density: 0.3 |
|
| 28 |
|
public class ReferenceHandlerTest extends TestCase |
| 29 |
|
{ |
| 30 |
|
private TestReferenceHandler clazz; |
| 31 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 32 |
2 |
protected void setUp() throws Exception... |
| 33 |
|
{ |
| 34 |
2 |
super.setUp(); |
| 35 |
2 |
this.clazz = new TestReferenceHandler(true, true); |
| 36 |
|
} |
| 37 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
| 38 |
1 |
public void testHandleImageUppercase()... |
| 39 |
|
{ |
| 40 |
1 |
WikiReference ref = new WikiReference("Image:foo.png", "bar"); |
| 41 |
1 |
clazz.handle(ref); |
| 42 |
1 |
assertEquals("foo.png", clazz.getImgRef()); |
| 43 |
1 |
assertEquals("bar", clazz.getImgLabel()); |
| 44 |
|
} |
| 45 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
| 46 |
1 |
public void testHandleImageLowercase()... |
| 47 |
|
{ |
| 48 |
1 |
WikiReference ref = new WikiReference("image:bar.png", "foo"); |
| 49 |
1 |
clazz.handle(ref); |
| 50 |
1 |
assertEquals("bar.png", clazz.getImgRef()); |
| 51 |
1 |
assertEquals("foo", clazz.getImgLabel()); |
| 52 |
|
} |
| 53 |
|
|
| 54 |
|
|
| 55 |
|
|
| 56 |
|
|
| 57 |
|
|
| 58 |
|
|
| 59 |
|
@author |
| 60 |
|
|
| |
|
| 90% |
Uncovered Elements: 1 (10) |
Complexity: 5 |
Complexity Density: 1 |
|
| 61 |
|
private static class TestReferenceHandler extends ReferenceHandler |
| 62 |
|
{ |
| 63 |
|
private String imgRef; |
| 64 |
|
|
| 65 |
|
private String imgLabel; |
| 66 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 67 |
2 |
protected TestReferenceHandler(boolean supportImage,... |
| 68 |
|
boolean supportDownload) |
| 69 |
|
{ |
| 70 |
2 |
super(supportImage, supportDownload); |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
|
| 74 |
|
|
| 75 |
|
|
| 76 |
|
@see |
| 77 |
|
|
| 78 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 79 |
2 |
@Override... |
| 80 |
|
protected void handleImage(String ref, String label, |
| 81 |
|
WikiParameters params) |
| 82 |
|
{ |
| 83 |
2 |
imgRef = ref; |
| 84 |
2 |
imgLabel = label; |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
|
| 88 |
|
|
| 89 |
|
|
| 90 |
|
@see |
| 91 |
|
|
| 92 |
|
|
| 93 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 94 |
0 |
@Override... |
| 95 |
|
protected void handleReference(String ref, String label, |
| 96 |
|
WikiParameters params) |
| 97 |
|
{ |
| 98 |
|
|
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
|
| 102 |
|
@return |
| 103 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 104 |
2 |
public String getImgRef()... |
| 105 |
|
{ |
| 106 |
2 |
return imgRef; |
| 107 |
|
} |
| 108 |
|
|
| 109 |
|
|
| 110 |
|
@return |
| 111 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 112 |
2 |
public String getImgLabel()... |
| 113 |
|
{ |
| 114 |
2 |
return imgLabel; |
| 115 |
|
} |
| 116 |
|
} |
| 117 |
|
} |