From 0283ff6405a2f26d15ebdbc52f6ad01f0f66cb2f Mon Sep 17 00:00:00 2001 From: Bruno Verachten Date: Fri, 15 Nov 2024 15:27:10 +0100 Subject: [PATCH] Delete plugin-modernizer-core/src/test/java/io/jenkins/tools/pluginmodernizer/core/recipe/AddJellyXmlDeclarationTest.java --- .../recipe/AddJellyXmlDeclarationTest.java | 91 ------------------- 1 file changed, 91 deletions(-) delete mode 100644 plugin-modernizer-core/src/test/java/io/jenkins/tools/pluginmodernizer/core/recipe/AddJellyXmlDeclarationTest.java diff --git a/plugin-modernizer-core/src/test/java/io/jenkins/tools/pluginmodernizer/core/recipe/AddJellyXmlDeclarationTest.java b/plugin-modernizer-core/src/test/java/io/jenkins/tools/pluginmodernizer/core/recipe/AddJellyXmlDeclarationTest.java deleted file mode 100644 index 94032b5c..00000000 --- a/plugin-modernizer-core/src/test/java/io/jenkins/tools/pluginmodernizer/core/recipe/AddJellyXmlDeclarationTest.java +++ /dev/null @@ -1,91 +0,0 @@ -package io.jenkins.tools.pluginmodernizer.core.recipe; - -import static org.openrewrite.test.SourceSpecs.text; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import org.junit.jupiter.api.Test; -import org.junit.jupiter.api.io.TempDir; -import org.openrewrite.Recipe; -import org.openrewrite.test.RewriteTest; -import org.openrewrite.text.PlainTextParser; - -/** - * Test class for the AddJellyXmlDeclaration recipe. - */ -public class AddJellyXmlDeclarationTest implements RewriteTest { - - /** - * Returns the recipe to be tested. - * - * @return the AddJellyXmlDeclaration recipe - */ - public Recipe getRecipe() { - return new AddJellyXmlDeclaration(); - } - - /** - * Test to verify that the XML declaration is added to a Jelly file. - * - * @param tempDir the temporary directory provided by JUnit - * @throws IOException if an I/O error occurs - */ - @Test - void addXmlDeclarationToJellyFile(@TempDir Path tempDir) throws IOException { - Path inputFile = tempDir.resolve("example.jelly"); - Files.writeString( - inputFile, - """ - - -

Hello, World!

-
- """); - - Path expectedFile = tempDir.resolve("expected.jelly"); - Files.writeString( - expectedFile, - """ - - - -

Hello, World!

-
- """); - - rewriteRun( - spec -> spec.recipe(new AddJellyXmlDeclaration()) - .parser(PlainTextParser.builder()) - .expectedCyclesThatMakeChanges(1) - .cycles(1), - text(Files.readString(inputFile), Files.readString(expectedFile))); - } - - /** - * Test to verify that the XML declaration is not added if it is already present in the Jelly file. - * - * @param tempDir the temporary directory provided by JUnit - * @throws IOException if an I/O error occurs - */ - @Test - void doNotAddXmlDeclarationIfAlreadyPresent(@TempDir Path tempDir) throws IOException { - Path inputFile = tempDir.resolve("example.jelly"); - Files.writeString( - inputFile, - """ - - - -

Hello, World!

-
- """); - - rewriteRun( - spec -> spec.recipe(new AddJellyXmlDeclaration()) - .parser(PlainTextParser.builder()) - .expectedCyclesThatMakeChanges(1) - .cycles(0), - text(Files.readString(inputFile))); - } -}