| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
package org.devacfr.maven.skins.reflow.snippet; |
| 17 |
|
|
| 18 |
|
import java.io.IOException; |
| 19 |
|
import org.jsoup.nodes.Element; |
| 20 |
|
import org.junit.jupiter.api.BeforeEach; |
| 21 |
|
import org.junit.jupiter.api.Test; |
| 22 |
|
|
| |
|
| 84,1% |
Uncovered Elements: 7 (44) |
Complexity: 16 |
Complexity Density: 0,46 |
|
| 23 |
|
public class SnippetParserTest extends BaseSnippetTest { |
| 24 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
| 25 |
8 |
@BeforeEach... |
| 26 |
|
public void setup() { |
| 27 |
8 |
velocityContext = SnippetContext.createToolManaged().createContext(); |
| 28 |
8 |
when(config.getVelocityContext()).thenReturn(velocityContext); |
| 29 |
|
} |
| 30 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0,2 |
1PASS
|
|
| 31 |
1 |
@Test... |
| 32 |
|
public void shouldContainSnippetComponent() { |
| 33 |
1 |
SnippetParser parser = createParser(); |
| 34 |
1 |
parser.addResourcePath(getPackagePath().toString()).refreshParser(); |
| 35 |
1 |
assertEquals(true, parser.hasIncludedSnippetComponent(new Element("body").append("<test class=\"cl\"></test>"))); |
| 36 |
1 |
assertEquals(true, parser.hasIncludedSnippetComponent(new Element("body").append("<test class=\"cl\"></test>"))); |
| 37 |
1 |
assertEquals(false, parser.hasIncludedSnippetComponent(new Element("body").append("<test1></test1>"))); |
| 38 |
|
} |
| 39 |
|
|
| |
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0,5 |
1PASS
|
|
| 40 |
1 |
@Test... |
| 41 |
|
public void shouldReplaceSnippetByHtml() throws Exception { |
| 42 |
1 |
verify((htmlSource) -> { |
| 43 |
1 |
try { |
| 44 |
1 |
return createParser().parse(config, htmlSource).html(); |
| 45 |
|
} catch (final IOException e) { |
| 46 |
0 |
throw new RuntimeException(e.getMessage(), e); |
| 47 |
|
} |
| 48 |
|
}, "html"); |
| 49 |
|
} |
| 50 |
|
|
| |
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0,5 |
1PASS
|
|
| 51 |
1 |
@Test... |
| 52 |
|
public void shouldRenderCard() { |
| 53 |
1 |
verify((htmlSource) -> { |
| 54 |
1 |
try { |
| 55 |
1 |
return createParser().parse(config, htmlSource).html(); |
| 56 |
|
} catch (final IOException e) { |
| 57 |
0 |
throw new RuntimeException(e.getMessage(), e); |
| 58 |
|
} |
| 59 |
|
}, "html"); |
| 60 |
|
} |
| 61 |
|
|
| |
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0,5 |
1PASS
|
|
| 62 |
1 |
@Test... |
| 63 |
|
public void shouldRenderDebug() { |
| 64 |
1 |
verify((htmlSource) -> { |
| 65 |
1 |
try { |
| 66 |
1 |
return createParser().parse(config, htmlSource).html(); |
| 67 |
|
} catch (final IOException e) { |
| 68 |
0 |
throw new RuntimeException(e.getMessage(), e); |
| 69 |
|
} |
| 70 |
|
}, "html"); |
| 71 |
|
} |
| 72 |
|
|
| |
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0,5 |
1PASS
|
|
| 73 |
1 |
@Test... |
| 74 |
|
public void shouldRenderCardRecursively() { |
| 75 |
1 |
verify((htmlSource) -> { |
| 76 |
1 |
try { |
| 77 |
1 |
return createParser().parse(config, htmlSource).html(); |
| 78 |
|
} catch (final IOException e) { |
| 79 |
0 |
throw new RuntimeException(e.getMessage(), e); |
| 80 |
|
} |
| 81 |
|
}, "html"); |
| 82 |
|
} |
| 83 |
|
|
| |
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0,5 |
1PASS
|
|
| 84 |
1 |
@Test... |
| 85 |
|
public void shouldRenderBadge() { |
| 86 |
1 |
verify((htmlSource) -> { |
| 87 |
1 |
try { |
| 88 |
1 |
return createParser().parse(config, htmlSource).html(); |
| 89 |
|
} catch (final IOException e) { |
| 90 |
0 |
throw new RuntimeException(e.getMessage(), e); |
| 91 |
|
} |
| 92 |
|
}, "html"); |
| 93 |
|
} |
| 94 |
|
|
| |
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0,5 |
1PASS
|
|
| 95 |
1 |
@Test... |
| 96 |
|
public void shouldRenderLayout() { |
| 97 |
1 |
verify((htmlSource) -> { |
| 98 |
1 |
try { |
| 99 |
1 |
return createParser().parse(config, htmlSource).html(); |
| 100 |
|
} catch (final IOException e) { |
| 101 |
0 |
throw new RuntimeException(e.getMessage(), e); |
| 102 |
|
} |
| 103 |
|
}, "html"); |
| 104 |
|
} |
| 105 |
|
|
| |
|
| 75% |
Uncovered Elements: 1 (4) |
Complexity: 2 |
Complexity Density: 0,5 |
1PASS
|
|
| 106 |
1 |
@Test... |
| 107 |
|
public void shouldRenderNestedComponent() { |
| 108 |
1 |
verify((htmlSource) -> { |
| 109 |
1 |
try { |
| 110 |
1 |
return createParser().parse(config, htmlSource).html(); |
| 111 |
|
} catch (final IOException e) { |
| 112 |
0 |
throw new RuntimeException(e.getMessage(), e); |
| 113 |
|
} |
| 114 |
|
}, "html"); |
| 115 |
|
} |
| 116 |
|
|
| 117 |
|
} |