|
1 | 1 | package org.itsallcode.openfasttrace.importer.markdown; |
2 | 2 |
|
| 3 | +import static org.hamcrest.Matchers.emptyIterable; |
3 | 4 | import static org.itsallcode.matcher.auto.AutoMatcher.contains; |
4 | 5 | import static org.itsallcode.openfasttrace.testutil.core.ItemBuilderFactory.item; |
5 | 6 |
|
6 | | -import org.hamcrest.Matchers; |
7 | 7 | import org.itsallcode.openfasttrace.api.core.SpecificationItemId; |
8 | 8 | import org.itsallcode.openfasttrace.api.importer.ImporterFactory; |
9 | 9 | import org.itsallcode.openfasttrace.testutil.importer.lightweightmarkup.AbstractLightWeightMarkupImporterTest; |
10 | 10 | import org.junit.jupiter.api.Test; |
11 | 11 | import org.junit.jupiter.params.ParameterizedTest; |
| 12 | +import org.junit.jupiter.params.provider.CsvSource; |
12 | 13 | import org.junit.jupiter.params.provider.ValueSource; |
13 | 14 |
|
14 | 15 | class TestMarkdownMarkupImporter extends AbstractLightWeightMarkupImporterTest |
@@ -140,25 +141,36 @@ void testLessThenThreeUnderliningCharactersAreNotDetectedAsTitleUnderlines() |
140 | 141 | .build())); |
141 | 142 | } |
142 | 143 |
|
143 | | - @Test |
144 | | - void testWhenInsideMarkdownCodeBlockThenNoSpecificationItemMustBeDetected() { |
| 144 | + @ParameterizedTest |
| 145 | + @CsvSource( |
| 146 | + { |
| 147 | + "```,```", |
| 148 | + "``` ,``` ", |
| 149 | + "``` ,```", |
| 150 | + "```java, ```", |
| 151 | + "```java , ``` ", |
| 152 | + }) |
| 153 | + void testWhenInsideMarkdownCodeBlockThenNoSpecificationItemMustBeDetected(final String startMarker, |
| 154 | + final String endMarker) |
| 155 | + { |
145 | 156 | assertImport("file_with_code_block.md", """ |
146 | | - ``` |
147 | | - This is a code block, the following requirement must be ignored. |
148 | | - |
149 | | - req~example~1 |
150 | | - ``` |
151 | | - """, |
152 | | - Matchers.emptyIterable()); |
| 157 | + %s |
| 158 | + This is a code block, the following requirement must be ignored. |
| 159 | +
|
| 160 | + req~example~1 |
| 161 | + %s |
| 162 | + """.formatted(startMarker, endMarker), |
| 163 | + emptyIterable()); |
153 | 164 | } |
154 | 165 |
|
155 | 166 | // Unit Test |
156 | 167 | @Test |
157 | | - void testWhenCodeBlockIsInsideCommentSectionThenItIsImportedAsPartOfComment() { |
| 168 | + void testWhenCodeBlockIsInsideCommentSectionThenItIsImportedAsPartOfComment() |
| 169 | + { |
158 | 170 | assertImport("file_with_code_block_in_comment.md", """ |
159 | 171 | req~comment_with_code_block~1 |
160 | 172 | Comment: |
161 | | - |
| 173 | +
|
162 | 174 | ``` |
163 | 175 | This is a code block inside a comment. |
164 | 176 | ``` |
|
0 commit comments