| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
package org.apache.maven.doxia.module.markdown; |
| 17 |
|
|
| 18 |
|
import static org.junit.jupiter.api.Assertions.assertNotNull; |
| 19 |
|
|
| 20 |
|
import com.google.common.base.Throwables; |
| 21 |
|
import java.io.Reader; |
| 22 |
|
import java.io.StringReader; |
| 23 |
|
import javax.inject.Inject; |
| 24 |
|
import org.apache.maven.doxia.parser.AbstractParser; |
| 25 |
|
import org.devacfr.testing.jupiter.ParserTestCase; |
| 26 |
|
import org.jsoup.Jsoup; |
| 27 |
|
import org.junit.jupiter.api.Test; |
| 28 |
|
|
| |
|
| 83,3% |
Uncovered Elements: 6 (36) |
Complexity: 13 |
Complexity Density: 0,46 |
|
| 29 |
|
public class MarkdownParserTest extends ParserTestCase { |
| 30 |
|
|
| 31 |
|
@Inject |
| 32 |
|
private MarkdownParser parser; |
| 33 |
|
|
| 34 |
|
|
| 35 |
|
@inheritDoc |
| 36 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 37 |
6 |
@Override... |
| 38 |
|
protected AbstractParser createParser() { |
| 39 |
6 |
return parser; |
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
|
| 43 |
|
@inheritDoc |
| 44 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 45 |
6 |
@Override... |
| 46 |
|
protected String outputExtension() { |
| 47 |
6 |
return MarkdownParserModule.FILE_EXTENSION; |
| 48 |
|
} |
| 49 |
|
|
| |
|
| 71,4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0,29 |
1PASS
|
|
| 50 |
2 |
@Test... |
| 51 |
|
public void shouldParseToHtml() { |
| 52 |
2 |
assertNotNull(parser); |
| 53 |
2 |
verify(content -> { |
| 54 |
2 |
try { |
| 55 |
2 |
final String html = parseFileToHtml(content); |
| 56 |
2 |
return Jsoup.parse(html).html(); |
| 57 |
|
} catch (final Exception e) { |
| 58 |
0 |
Throwables.throwIfUnchecked(e); |
| 59 |
0 |
throw new RuntimeException(e); |
| 60 |
|
} |
| 61 |
|
}, "md", "html"); |
| 62 |
|
} |
| 63 |
|
|
| |
|
| 71,4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0,29 |
1PASS
|
|
| 64 |
2 |
@Test... |
| 65 |
|
public void shouldParseSnippetToHtml() { |
| 66 |
2 |
assertNotNull(parser); |
| 67 |
2 |
verify(content -> { |
| 68 |
2 |
try { |
| 69 |
2 |
final String html = parseFileToHtml(content); |
| 70 |
2 |
return Jsoup.parse(html).html(); |
| 71 |
|
} catch (final Exception e) { |
| 72 |
0 |
Throwables.throwIfUnchecked(e); |
| 73 |
0 |
throw new RuntimeException(e); |
| 74 |
|
} |
| 75 |
|
}, "md", "html"); |
| 76 |
|
} |
| 77 |
|
|
| |
|
| 71,4% |
Uncovered Elements: 2 (7) |
Complexity: 2 |
Complexity Density: 0,29 |
1PASS
|
|
| 78 |
2 |
@Test... |
| 79 |
|
public void test() { |
| 80 |
2 |
assertNotNull(parser); |
| 81 |
2 |
verify(content -> { |
| 82 |
2 |
try { |
| 83 |
2 |
final String html = parseFileToHtml(content); |
| 84 |
2 |
return Jsoup.parse(html).html(); |
| 85 |
|
} catch (final Exception e) { |
| 86 |
0 |
Throwables.throwIfUnchecked(e); |
| 87 |
0 |
throw new RuntimeException(e); |
| 88 |
|
} |
| 89 |
|
}, "md", "html"); |
| 90 |
|
} |
| 91 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 3 |
Complexity Density: 1 |
|
| 92 |
6 |
protected String parseFileToHtml(final String content) throws Exception {... |
| 93 |
6 |
try (Reader reader = new StringReader(content)) { |
| 94 |
6 |
return parser.toHtml(reader).toString(); |
| 95 |
|
} |
| 96 |
|
} |
| 97 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 98 |
2 |
@Override... |
| 99 |
|
protected String getVerbatimSource() { |
| 100 |
|
|
| 101 |
|
|
| 102 |
|
|
| 103 |
|
|
| 104 |
2 |
return null; |
| 105 |
|
} |
| 106 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 107 |
2 |
@Override... |
| 108 |
|
protected String getVerbatimCodeSource() { |
| 109 |
2 |
return null; |
| 110 |
|
} |
| 111 |
|
} |