From d64456d09a70124e5557104c95cd90dbbebbd2bc Mon Sep 17 00:00:00 2001 From: redcatbaer Date: Mon, 6 Jan 2025 19:17:03 +0100 Subject: [PATCH] #431: Added bad weather test scenario. --- .../markdown/TestMarkdownMarkupImporter.java | 43 ++++++++++++++++--- 1 file changed, 37 insertions(+), 6 deletions(-) diff --git a/importer/markdown/src/test/java/org/itsallcode/openfasttrace/importer/markdown/TestMarkdownMarkupImporter.java b/importer/markdown/src/test/java/org/itsallcode/openfasttrace/importer/markdown/TestMarkdownMarkupImporter.java index 67d66a56..7e24559d 100644 --- a/importer/markdown/src/test/java/org/itsallcode/openfasttrace/importer/markdown/TestMarkdownMarkupImporter.java +++ b/importer/markdown/src/test/java/org/itsallcode/openfasttrace/importer/markdown/TestMarkdownMarkupImporter.java @@ -161,16 +161,47 @@ void testWhenInsideMarkdownCodeBlockThenNoSpecificationItemMustBeDetected(final final String endMarker) { assertImport("file_with_code_block.md", """ - %s - This is a code block, the following requirement must be ignored. + %s + This is a code block, the following requirement must be ignored. - req~example~1 - %s - """.formatted(startMarker, endMarker), + req~example~1 + %s + """.formatted(startMarker, endMarker), emptyIterable()); } - // Unit Test + @ParameterizedTest + @CsvSource( + { + "'', ''", + "', '", + "'`', '`'", + "'``', '``'", + "'````', '````'", + "'``` ', ' ```'", + "'``` ', ' ```'", + "' ```', '``` '", + "'```java ', ' ```java'", + "'~~~', '~~~'", + "'~~~java', '~~~java'", + "'~~~~java ', ' ~~~~java '" + }) + void testWhenNotInsideMarkdownCodeBlockThenSpecificationItemMustBeDetected(final String startMarker, + final String endMarker) + { + assertImport("file_without_code_block.md", """ + %s + This is not a code block, the following requirement must be detected. + + req~example~1 + %s + """.formatted(startMarker, endMarker), + contains(item() + .id(SpecificationItemId.parseId("req~example~1")) + .location("file_without_code_block.md", 4) + .build())); + } + @Test void testWhenCodeBlockIsInsideCommentSectionThenItIsImportedAsPartOfComment() {