| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
package org.devacfr.maven.skins.reflow; |
| 20 |
|
|
| 21 |
|
import java.util.List; |
| 22 |
|
|
| 23 |
|
import org.codehaus.plexus.util.xml.Xpp3Dom; |
| 24 |
|
import org.devacfr.testing.jupiter.TestCase; |
| 25 |
|
import org.hamcrest.Matchers; |
| 26 |
|
import org.junit.jupiter.api.Test; |
| 27 |
|
|
| 28 |
|
import static org.hamcrest.MatcherAssert.assertThat; |
| 29 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (44) |
Complexity: 11 |
Complexity Density: 0,37 |
|
| 30 |
|
public class Xpp3UtilsTest extends TestCase { |
| 31 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
1PASS
|
|
| 32 |
1 |
@Test... |
| 33 |
|
public void shouldFirstChildReturnNullWhenParentIsNull() { |
| 34 |
1 |
assertNull(Xpp3Utils.getFirstChild(null, "", "")); |
| 35 |
|
} |
| 36 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1PASS
|
|
| 37 |
1 |
@Test... |
| 38 |
|
public void shouldChildNodeExist() { |
| 39 |
1 |
final Xpp3Dom expectedChild = new Xpp3Dom("expected-child"); |
| 40 |
1 |
final Xpp3Dom parent = new Xpp3Dom("parent"); |
| 41 |
1 |
parent.addChild(new Xpp3Dom("child")); |
| 42 |
1 |
parent.addChild(expectedChild); |
| 43 |
|
|
| 44 |
1 |
assertEquals(expectedChild, Xpp3Utils.getFirstChild(parent, "expected-child", "")); |
| 45 |
|
} |
| 46 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1PASS
|
|
| 47 |
1 |
@Test... |
| 48 |
|
public void shouldChildNodeNotExist() { |
| 49 |
1 |
final Xpp3Dom expectedChild = new Xpp3Dom("expected-child"); |
| 50 |
1 |
final Xpp3Dom parent = new Xpp3Dom("parent"); |
| 51 |
1 |
parent.addChild(new Xpp3Dom("child")); |
| 52 |
1 |
parent.addChild(expectedChild); |
| 53 |
|
|
| 54 |
1 |
assertNull(Xpp3Utils.getFirstChild(parent, "wrong-child", "")); |
| 55 |
|
} |
| 56 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
1PASS
|
|
| 57 |
1 |
@Test... |
| 58 |
|
public void shouldChildrenNodesReturnEmptyListWhenParentIsNull() { |
| 59 |
1 |
final List<Xpp3Dom> list = Xpp3Utils.getChildrenNodes(null, ""); |
| 60 |
1 |
assertThat(list, Matchers.empty()); |
| 61 |
|
} |
| 62 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
1PASS
|
|
| 63 |
1 |
@Test... |
| 64 |
|
public void shouldChildrenReturnEmptyListWhenParentIsNull() { |
| 65 |
1 |
final List<String> list = Xpp3Utils.getChildren(null); |
| 66 |
1 |
assertThat(list, Matchers.empty()); |
| 67 |
|
} |
| 68 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 2 |
Complexity Density: 0,4 |
1PASS
|
|
| 69 |
1 |
@Test... |
| 70 |
|
public void shouldChildrenReturnAllChildrenNodes() { |
| 71 |
1 |
final Xpp3Dom parent = new Xpp3Dom("parent"); |
| 72 |
11 |
for (int i = 0; i < 10; i++) { |
| 73 |
10 |
parent.addChild(new Xpp3Dom("child")); |
| 74 |
|
} |
| 75 |
|
|
| 76 |
1 |
final List<String> list = Xpp3Utils.getChildren(parent); |
| 77 |
1 |
assertThat(list, Matchers.hasSize(10)); |
| 78 |
|
} |
| 79 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (11) |
Complexity: 3 |
Complexity Density: 0,43 |
1PASS
|
|
| 80 |
1 |
@Test... |
| 81 |
|
public void shouldChildrenNodesReturnSpecificChildrenNodes() { |
| 82 |
1 |
final Xpp3Dom parent = new Xpp3Dom("parent"); |
| 83 |
11 |
for (int i = 0; i < 10; i++) { |
| 84 |
10 |
parent.addChild(new Xpp3Dom("child")); |
| 85 |
|
} |
| 86 |
11 |
for (int i = 0; i < 10; i++) { |
| 87 |
10 |
parent.addChild(new Xpp3Dom("child-other")); |
| 88 |
|
} |
| 89 |
|
|
| 90 |
1 |
final List<Xpp3Dom> list = Xpp3Utils.getChildrenNodes(parent, "child"); |
| 91 |
1 |
assertThat(list, Matchers.hasSize(10)); |
| 92 |
|
} |
| 93 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0,33 |
1PASS
|
|
| 94 |
1 |
@Test... |
| 95 |
|
public void shouldChildrenNodesReturnEmptyChildrenNodes() { |
| 96 |
1 |
final Xpp3Dom parent = new Xpp3Dom("parent"); |
| 97 |
1 |
final List<Xpp3Dom> list = Xpp3Utils.getChildrenNodes(parent, "child"); |
| 98 |
1 |
assertThat(list, Matchers.empty()); |
| 99 |
|
} |
| 100 |
|
} |