| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
|
| 21 |
|
package com.xpn.xwiki.plugin.tag; |
| 22 |
|
|
| 23 |
|
import org.hamcrest.Matchers; |
| 24 |
|
import org.junit.Assert; |
| 25 |
|
import org.junit.Test; |
| 26 |
|
|
| 27 |
|
import com.xpn.xwiki.XWikiException; |
| 28 |
|
|
| 29 |
|
|
| 30 |
|
|
| 31 |
|
@link |
| 32 |
|
|
| 33 |
|
@version |
| 34 |
|
@since |
| 35 |
|
|
| |
|
| 77.8% |
Uncovered Elements: 4 (18) |
Complexity: 6 |
Complexity Density: 0.38 |
|
| 36 |
|
public class TagParamUtilsTest |
| 37 |
|
{ |
| |
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0.25 |
1PASS
|
|
| 38 |
1 |
@Test... |
| 39 |
|
public void spacesParameterToList() throws Exception |
| 40 |
|
{ |
| 41 |
1 |
Assert.assertThat(TagParamUtils.spacesParameterToList("'Space1','Space2'"), |
| 42 |
|
Matchers.contains("Space1", "Space2")); |
| 43 |
1 |
Assert.assertThat(TagParamUtils.spacesParameterToList("'Space1', 'Space 2', 'Apo''strophe'"), |
| 44 |
|
Matchers.contains("Space1", "Space 2", "Apo'strophe")); |
| 45 |
1 |
Assert.assertThat(TagParamUtils.spacesParameterToList("'single space'"), |
| 46 |
|
Matchers.contains("single space")); |
| 47 |
1 |
Assert.assertThat(TagParamUtils.spacesParameterToList(""), |
| 48 |
|
Matchers.empty()); |
| 49 |
|
} |
| 50 |
|
|
| |
|
| 66.7% |
Uncovered Elements: 4 (12) |
Complexity: 5 |
Complexity Density: 0.42 |
1PASS
|
|
| 51 |
1 |
@Test... |
| 52 |
|
public void spacesParameterToListExceptions() throws XWikiException |
| 53 |
|
{ |
| 54 |
1 |
try { |
| 55 |
1 |
TagParamUtils.spacesParameterToList(null); |
| 56 |
0 |
Assert.fail("npe expected"); |
| 57 |
|
} catch (IllegalArgumentException expected) {} |
| 58 |
|
|
| 59 |
1 |
try { |
| 60 |
1 |
TagParamUtils.spacesParameterToList("'space1','space2"); |
| 61 |
0 |
Assert.fail("XWikiException expected"); |
| 62 |
|
} catch (XWikiException expected) {} |
| 63 |
1 |
try { |
| 64 |
1 |
TagParamUtils.spacesParameterToList("'space1','space2',"); |
| 65 |
0 |
Assert.fail("XWikiException expected"); |
| 66 |
|
} catch (XWikiException expected) {} |
| 67 |
1 |
try { |
| 68 |
1 |
TagParamUtils.spacesParameterToList("'space1', or 'space2'"); |
| 69 |
0 |
Assert.fail("XWikiException expected"); |
| 70 |
|
} catch (XWikiException expected) {} |
| 71 |
|
} |
| 72 |
|
|
| 73 |
|
|
| 74 |
|
} |