Skip to content

Commit 3233979

Browse files
committed
#280: Added test for different start or end markers.
1 parent bb54b0c commit 3233979

File tree

1 file changed

+24
-12
lines changed

1 file changed

+24
-12
lines changed

importer/markdown/src/test/java/org/itsallcode/openfasttrace/importer/markdown/TestMarkdownMarkupImporter.java

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
package org.itsallcode.openfasttrace.importer.markdown;
22

3+
import static org.hamcrest.Matchers.emptyIterable;
34
import static org.itsallcode.matcher.auto.AutoMatcher.contains;
45
import static org.itsallcode.openfasttrace.testutil.core.ItemBuilderFactory.item;
56

6-
import org.hamcrest.Matchers;
77
import org.itsallcode.openfasttrace.api.core.SpecificationItemId;
88
import org.itsallcode.openfasttrace.api.importer.ImporterFactory;
99
import org.itsallcode.openfasttrace.testutil.importer.lightweightmarkup.AbstractLightWeightMarkupImporterTest;
1010
import org.junit.jupiter.api.Test;
1111
import org.junit.jupiter.params.ParameterizedTest;
12+
import org.junit.jupiter.params.provider.CsvSource;
1213
import org.junit.jupiter.params.provider.ValueSource;
1314

1415
class TestMarkdownMarkupImporter extends AbstractLightWeightMarkupImporterTest
@@ -140,25 +141,36 @@ void testLessThenThreeUnderliningCharactersAreNotDetectedAsTitleUnderlines()
140141
.build()));
141142
}
142143

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+
{
145156
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());
153164
}
154165

155166
// Unit Test
156167
@Test
157-
void testWhenCodeBlockIsInsideCommentSectionThenItIsImportedAsPartOfComment() {
168+
void testWhenCodeBlockIsInsideCommentSectionThenItIsImportedAsPartOfComment()
169+
{
158170
assertImport("file_with_code_block_in_comment.md", """
159171
req~comment_with_code_block~1
160172
Comment:
161-
173+
162174
```
163175
This is a code block inside a comment.
164176
```

0 commit comments

Comments
 (0)