From 2ba4c0310140fc62042c7b02ce5cf786dabc8936 Mon Sep 17 00:00:00 2001 From: Renan Franca Date: Tue, 14 May 2024 16:00:58 -0300 Subject: [PATCH 1/9] support add instructions at the end of tasks.test in the build.gradle.kts support add instructions at the end of tasks.test --- .../command/AddGradleConfiguration.java | 2 +- .../command/AddTasksTestInstruction.java | 13 ++++ .../javabuild/command/JavaBuildCommand.java | 3 +- .../FileSystemJavaBuildCommandsHandler.java | 1 + .../JavaDependenciesCommandHandler.java | 2 + .../gradle/GradleCommandHandler.java | 17 +++++ .../maven/MavenCommandHandler.java | 14 +++- .../gradle/build.gradle.kts.mustache | 1 + .../gradle/GradleCommandHandlerTest.java | 70 +++++++++++++++++++ .../projects/empty-gradle/build.gradle.kts | 1 + 10 files changed, 120 insertions(+), 4 deletions(-) create mode 100644 src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddTasksTestInstruction.java diff --git a/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddGradleConfiguration.java b/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddGradleConfiguration.java index dc4c78fbe27..cca3046b4ec 100644 --- a/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddGradleConfiguration.java +++ b/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddGradleConfiguration.java @@ -4,7 +4,7 @@ public record AddGradleConfiguration(String configuration) implements JavaBuildCommand { public AddGradleConfiguration { - Assert.notNull("configuration", configuration); + Assert.notNull("instruction", configuration); } public String get() { diff --git a/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddTasksTestInstruction.java b/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddTasksTestInstruction.java new file mode 100644 index 00000000000..cb16a7f3d37 --- /dev/null +++ b/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddTasksTestInstruction.java @@ -0,0 +1,13 @@ +package tech.jhipster.lite.module.domain.javabuild.command; + +import tech.jhipster.lite.shared.error.domain.Assert; + +public record AddTasksTestInstruction(String instruction) implements JavaBuildCommand { + public AddTasksTestInstruction { + Assert.notNull("instruction", instruction); + } + + public String get() { + return instruction; + } +} diff --git a/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/JavaBuildCommand.java b/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/JavaBuildCommand.java index ffc35f7b645..1d7054c1f42 100644 --- a/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/JavaBuildCommand.java +++ b/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/JavaBuildCommand.java @@ -13,4 +13,5 @@ public sealed interface JavaBuildCommand RemoveJavaDependencyManagement, SetBuildProperty, SetVersion, - AddGradleConfiguration {} + AddGradleConfiguration, + AddTasksTestInstruction {} diff --git a/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/FileSystemJavaBuildCommandsHandler.java b/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/FileSystemJavaBuildCommandsHandler.java index 4dd1562f633..519bb1d5eeb 100644 --- a/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/FileSystemJavaBuildCommandsHandler.java +++ b/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/FileSystemJavaBuildCommandsHandler.java @@ -80,6 +80,7 @@ private void handle(JavaDependenciesCommandHandler handler, JavaBuildCommand com case AddJavaBuildProfile addJavaBuildProfile -> handler.handle(addJavaBuildProfile); case AddGradlePlugin addGradlePlugin -> handler.handle(addGradlePlugin); case AddGradleConfiguration addGradleConfiguration -> handler.handle(addGradleConfiguration); + case AddTasksTestInstruction addTasksTestInstruction -> handler.handle(addTasksTestInstruction); } } } diff --git a/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/JavaDependenciesCommandHandler.java b/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/JavaDependenciesCommandHandler.java index 1ab2b09e1db..6c239e76eec 100644 --- a/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/JavaDependenciesCommandHandler.java +++ b/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/JavaDependenciesCommandHandler.java @@ -26,4 +26,6 @@ public interface JavaDependenciesCommandHandler { void handle(AddGradlePlugin command); void handle(AddGradleConfiguration command); + + void handle(AddTasksTestInstruction command); } diff --git a/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandler.java b/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandler.java index 221ec09a353..a39edba11e7 100644 --- a/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandler.java +++ b/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandler.java @@ -70,6 +70,7 @@ public class GradleCommandHandler implements JavaDependenciesCommandHandler { "^// jhipster-needle-gradle-free-configuration-blocks$", Pattern.MULTILINE ); + private static final Pattern GRADLE_TASKS_TEST_NEEDLE = Pattern.compile("^\\s+// jhipster-needle-gradle-tasks-test$", Pattern.MULTILINE); private static final String PROFILE_CONDITIONAL_TEMPLATE = """ if (profiles.contains("%s")) { @@ -527,4 +528,20 @@ public void handle(AddGradleConfiguration command) { context ); } + + @Override + public void handle(AddTasksTestInstruction command) { + MandatoryReplacer replacer = new MandatoryReplacer( + new RegexNeedleBeforeReplacer( + (contentBeforeReplacement, newText) -> !contentBeforeReplacement.contains(newText), + GRADLE_TASKS_TEST_NEEDLE + ), + indentation.times(1) + command.get() + ); + fileReplacer.handle( + projectFolder, + ContentReplacers.of(new MandatoryFileReplacer(new JHipsterProjectFilePath(BUILD_GRADLE_FILE), replacer)), + context + ); + } } diff --git a/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/maven/MavenCommandHandler.java b/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/maven/MavenCommandHandler.java index 802a9c18fc9..9b0fae9183f 100644 --- a/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/maven/MavenCommandHandler.java +++ b/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/maven/MavenCommandHandler.java @@ -14,13 +14,18 @@ import org.codehaus.plexus.util.xml.Xpp3DomBuilder; import org.codehaus.plexus.util.xml.pull.XmlPullParserException; import tech.jhipster.lite.module.domain.Indentation; -import tech.jhipster.lite.module.domain.buildproperties.*; +import tech.jhipster.lite.module.domain.buildproperties.BuildProperty; +import tech.jhipster.lite.module.domain.buildproperties.PropertyKey; +import tech.jhipster.lite.module.domain.buildproperties.PropertyValue; import tech.jhipster.lite.module.domain.javabuild.MavenBuildExtension; import tech.jhipster.lite.module.domain.javabuild.VersionSlug; import tech.jhipster.lite.module.domain.javabuild.command.*; import tech.jhipster.lite.module.domain.javabuildprofile.BuildProfileActivation; import tech.jhipster.lite.module.domain.javabuildprofile.BuildProfileId; -import tech.jhipster.lite.module.domain.javadependency.*; +import tech.jhipster.lite.module.domain.javadependency.DependencyId; +import tech.jhipster.lite.module.domain.javadependency.JavaDependency; +import tech.jhipster.lite.module.domain.javadependency.JavaDependencyClassifier; +import tech.jhipster.lite.module.domain.javadependency.JavaDependencyScope; import tech.jhipster.lite.module.domain.mavenplugin.*; import tech.jhipster.lite.module.infrastructure.secondary.javadependency.JavaDependenciesCommandHandler; import tech.jhipster.lite.shared.enumeration.domain.Enums; @@ -340,6 +345,11 @@ public void handle(AddGradleConfiguration command) { // Gradle commands are ignored } + @Override + public void handle(AddTasksTestInstruction command) { + // Gradle commands are ignored + } + private Plugin toMavenPlugin(AddMavenPlugin command) { Plugin mavenPlugin = new Plugin(); mavenPlugin.setArtifactId(command.dependencyId().artifactId().get()); diff --git a/src/main/resources/generator/buildtool/gradle/build.gradle.kts.mustache b/src/main/resources/generator/buildtool/gradle/build.gradle.kts.mustache index 706dc6152d7..4a602927e37 100644 --- a/src/main/resources/generator/buildtool/gradle/build.gradle.kts.mustache +++ b/src/main/resources/generator/buildtool/gradle/build.gradle.kts.mustache @@ -44,6 +44,7 @@ tasks.test { excludeTestsMatching("**CucumberTest*") } useJUnitPlatform() + // jhipster-needle-gradle-tasks-test } val integrationTest = task("integrationTest") { diff --git a/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandlerTest.java b/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandlerTest.java index 7861be4e104..44be438248c 100644 --- a/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandlerTest.java +++ b/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandlerTest.java @@ -1518,6 +1518,76 @@ void shouldNotDuplicateExistingGradleFreeConfigurationBlock() { ); } + @Test + void shouldAddTasksTestInstruction() { + JHipsterProjectFolder projectFolder = projectFrom("src/test/resources/projects/empty-gradle"); + + new GradleCommandHandler(Indentation.DEFAULT, projectFolder, emptyModuleContext(), filesReader, templateRenderer).handle( + new AddTasksTestInstruction( + """ + dependsOn("testNpm")\ + """ + ) + ); + + assertThat(buildGradleContent(projectFolder)).contains( + """ + tasks.test { + filter { + includeTestsMatching("**Test*") + excludeTestsMatching("**IT*") + excludeTestsMatching("**CucumberTest*") + } + useJUnitPlatform() + dependsOn("testNpm") + // jhipster-needle-gradle-tasks-test + } + """ + ); + } + + @Test + void shouldNotDuplicateExistingTasksTestInstruction() { + JHipsterProjectFolder projectFolder = projectFrom("src/test/resources/projects/empty-gradle"); + GradleCommandHandler gradleCommandHandler = new GradleCommandHandler( + Indentation.DEFAULT, + projectFolder, + emptyModuleContext(), + filesReader, + templateRenderer + ); + gradleCommandHandler.handle( + new AddTasksTestInstruction( + """ + dependsOn("testNpm")\ + """ + ) + ); + + gradleCommandHandler.handle( + new AddTasksTestInstruction( + """ + dependsOn("testNpm")\ + """ + ) + ); + + assertThat(buildGradleContent(projectFolder)).contains( + """ + tasks.test { + filter { + includeTestsMatching("**Test*") + excludeTestsMatching("**IT*") + excludeTestsMatching("**CucumberTest*") + } + useJUnitPlatform() + dependsOn("testNpm") + // jhipster-needle-gradle-tasks-test + } + """ + ); + } + private static String buildGradleContent(JHipsterProjectFolder projectFolder) { return content(Paths.get(projectFolder.get()).resolve("build.gradle.kts")); } diff --git a/src/test/resources/projects/empty-gradle/build.gradle.kts b/src/test/resources/projects/empty-gradle/build.gradle.kts index 89cc51dc637..21d581bf1ad 100644 --- a/src/test/resources/projects/empty-gradle/build.gradle.kts +++ b/src/test/resources/projects/empty-gradle/build.gradle.kts @@ -45,6 +45,7 @@ tasks.test { excludeTestsMatching("**CucumberTest*") } useJUnitPlatform() + // jhipster-needle-gradle-tasks-test } val integrationTest = task("integrationTest") { From 99003b359ee8a3bf2750af770940c5f6506ba962 Mon Sep 17 00:00:00 2001 From: Renan Franca Date: Tue, 14 May 2024 22:10:56 -0300 Subject: [PATCH 2/9] increment GradleConfiguration API to support add instructions at the end of tasks.test in build.gradle.kts --- .../GradleConfiguration.java | 2 +- .../GradleTasksTestInstruction.java | 13 ++++++++ .../JHipsterModuleGradleConfigurations.java | 31 ++++++++++++++++++- .../module/domain/JHipsterModulesFixture.java | 7 +++++ ...leSystemJHipsterModulesRepositoryTest.java | 6 ++++ .../projects/init-gradle/build.gradle.kts | 1 + 6 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/GradleTasksTestInstruction.java diff --git a/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/GradleConfiguration.java b/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/GradleConfiguration.java index 6cab9d4e97a..d532773cb19 100644 --- a/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/GradleConfiguration.java +++ b/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/GradleConfiguration.java @@ -4,7 +4,7 @@ public record GradleConfiguration(String configuration) { public GradleConfiguration { - Assert.notBlank("configuration", configuration); + Assert.notBlank("instruction", configuration); } public String get() { diff --git a/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/GradleTasksTestInstruction.java b/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/GradleTasksTestInstruction.java new file mode 100644 index 00000000000..2b398364012 --- /dev/null +++ b/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/GradleTasksTestInstruction.java @@ -0,0 +1,13 @@ +package tech.jhipster.lite.module.domain.gradleconfiguration; + +import tech.jhipster.lite.shared.error.domain.Assert; + +record GradleTasksTestInstruction(String instruction) { + public GradleTasksTestInstruction { + Assert.notBlank("instruction", instruction); + } + + public String get() { + return instruction(); + } +} diff --git a/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/JHipsterModuleGradleConfigurations.java b/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/JHipsterModuleGradleConfigurations.java index a0ae12f73ef..5a58cb5e697 100644 --- a/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/JHipsterModuleGradleConfigurations.java +++ b/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/JHipsterModuleGradleConfigurations.java @@ -2,19 +2,25 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.function.Function; +import java.util.stream.Stream; import tech.jhipster.lite.module.domain.JHipsterModule.JHipsterModuleBuilder; import tech.jhipster.lite.module.domain.javabuild.command.AddGradleConfiguration; +import tech.jhipster.lite.module.domain.javabuild.command.AddTasksTestInstruction; import tech.jhipster.lite.module.domain.javabuild.command.JavaBuildCommands; import tech.jhipster.lite.shared.error.domain.Assert; public final class JHipsterModuleGradleConfigurations { private final Collection configurations; + private final Collection tasksTestInstructions; public JHipsterModuleGradleConfigurations(JHipsterModuleGradleConfigurationBuilder builder) { Assert.notNull("configurations", builder.configurations); + Assert.notNull("tasksTestInstructions", builder.tasksTestInstructions); this.configurations = builder.configurations; + this.tasksTestInstructions = builder.tasksTestInstructions; } public static JHipsterModuleGradleConfigurationBuilder builder(JHipsterModuleBuilder module) { @@ -22,13 +28,30 @@ public static JHipsterModuleGradleConfigurationBuilder builder(JHipsterModuleBui } public JavaBuildCommands buildChanges() { - return new JavaBuildCommands(configurations.stream().map(configuration -> new AddGradleConfiguration(configuration.get())).toList()); + return Stream.of(configurationToAddGradleConfiguration(), tasksTestInstructionsToAddTasksTestInstruction()) + .flatMap(Function.identity()) + .reduce(JavaBuildCommands.EMPTY, JavaBuildCommands::merge); + } + + private Stream configurationToAddGradleConfiguration() { + return Stream.of( + new JavaBuildCommands(configurations.stream().map(configuration -> new AddGradleConfiguration(configuration.get())).toList()) + ); + } + + private Stream tasksTestInstructionsToAddTasksTestInstruction() { + return Stream.of( + new JavaBuildCommands( + tasksTestInstructions.stream().map(tasksTestInstruction -> new AddTasksTestInstruction(tasksTestInstruction.get())).toList() + ) + ); } public static final class JHipsterModuleGradleConfigurationBuilder { private final JHipsterModuleBuilder module; private final Collection configurations = new ArrayList<>(); + private final Collection tasksTestInstructions = new ArrayList<>(); private JHipsterModuleGradleConfigurationBuilder(JHipsterModuleBuilder module) { Assert.notNull("module", module); @@ -42,6 +65,12 @@ public JHipsterModuleGradleConfigurationBuilder configuration(String configurati return this; } + public JHipsterModuleGradleConfigurationBuilder addTasksTestInstruction(String instruction) { + tasksTestInstructions.add(new GradleTasksTestInstruction(instruction)); + + return this; + } + public JHipsterModuleBuilder and() { return module; } diff --git a/src/test/java/tech/jhipster/lite/module/domain/JHipsterModulesFixture.java b/src/test/java/tech/jhipster/lite/module/domain/JHipsterModulesFixture.java index 49db31ac8fa..678c225056b 100644 --- a/src/test/java/tech/jhipster/lite/module/domain/JHipsterModulesFixture.java +++ b/src/test/java/tech/jhipster/lite/module/domain/JHipsterModulesFixture.java @@ -120,6 +120,13 @@ public static JHipsterModule module() { .plugin(jacocoGradlePlugin()) .plugin(checkstyleGradlePlugin()) .and() + .gradleConfigurations() + .addTasksTestInstruction( + """ + finalizedBy("jacocoTestReport")\ + """ + ) + .and() .javaBuildProfiles() .addProfile(localBuildProfile()) .activation(buildProfileActivation().activeByDefault(false)) diff --git a/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/FileSystemJHipsterModulesRepositoryTest.java b/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/FileSystemJHipsterModulesRepositoryTest.java index 71aed8316a4..79a30d72507 100644 --- a/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/FileSystemJHipsterModulesRepositoryTest.java +++ b/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/FileSystemJHipsterModulesRepositoryTest.java @@ -488,6 +488,12 @@ val springProfilesActive by extra("local") // jhipster-needle-gradle-free-configuration-blocks """ ) + .containing( + """ + finalizedBy("jacocoTestReport") + // jhipster-needle-gradle-tasks-test + """ + ) .and() .hasFile("buildSrc/build.gradle.kts") .containing( diff --git a/src/test/resources/projects/init-gradle/build.gradle.kts b/src/test/resources/projects/init-gradle/build.gradle.kts index 08b7d8907c5..665862f5730 100644 --- a/src/test/resources/projects/init-gradle/build.gradle.kts +++ b/src/test/resources/projects/init-gradle/build.gradle.kts @@ -45,6 +45,7 @@ tasks.test { excludeTestsMatching("**CucumberTest*") } useJUnitPlatform() + // jhipster-needle-gradle-tasks-test } val integrationTest = task("integrationTest") { From 0c9d75c3e1757e70b4815858852f9ea5e8fd920c Mon Sep 17 00:00:00 2001 From: Renan Meneses de Andrade Franca Date: Wed, 15 May 2024 09:22:29 -0300 Subject: [PATCH 3/9] refactor by improving configuration duplication test --- .../gradle/GradleCommandHandlerTest.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandlerTest.java b/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandlerTest.java index 44be438248c..d9afa099000 100644 --- a/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandlerTest.java +++ b/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandlerTest.java @@ -1491,7 +1491,7 @@ void shouldNotDuplicateExistingGradleFreeConfigurationBlock() { """ tasks.build { dependsOn("processResources") - } + }\ """ ) ); @@ -1501,19 +1501,16 @@ void shouldNotDuplicateExistingGradleFreeConfigurationBlock() { """ tasks.build { dependsOn("processResources") - } + }\ """ ) ); - assertThat(buildGradleContent(projectFolder)).contains( + assertThat(buildGradleContent(projectFolder)).containsOnlyOnce( """ - tasks.build { dependsOn("processResources") - } - - // jhipster-needle-gradle-free-configuration-blocks\ + }\ """ ); } From 0c1085e4b9e58ccc40b10bdaa90481c8689f68ff Mon Sep 17 00:00:00 2001 From: Renan Meneses de Andrade Franca Date: Wed, 15 May 2024 09:58:01 -0300 Subject: [PATCH 4/9] refactor by fixing Assert field name --- .../module/domain/gradleconfiguration/GradleConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/GradleConfiguration.java b/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/GradleConfiguration.java index d532773cb19..6cab9d4e97a 100644 --- a/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/GradleConfiguration.java +++ b/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/GradleConfiguration.java @@ -4,7 +4,7 @@ public record GradleConfiguration(String configuration) { public GradleConfiguration { - Assert.notBlank("instruction", configuration); + Assert.notBlank("configuration", configuration); } public String get() { From 01c5129f89a27c0da7e63561190fb052cc17ff1e Mon Sep 17 00:00:00 2001 From: Renan Meneses de Andrade Franca Date: Wed, 15 May 2024 10:43:39 -0300 Subject: [PATCH 5/9] refactor JacocoModuleFactory to use the .addTasksTestInstruction --- .../jacoco/domain/JacocoModuleFactory.java | 64 ++++--------------- .../domain/JacocoModuleFactoryTest.java | 18 +----- 2 files changed, 14 insertions(+), 68 deletions(-) diff --git a/src/main/java/tech/jhipster/lite/generator/server/javatool/jacoco/domain/JacocoModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/server/javatool/jacoco/domain/JacocoModuleFactory.java index e7221690e98..1d4b3a602f4 100644 --- a/src/main/java/tech/jhipster/lite/generator/server/javatool/jacoco/domain/JacocoModuleFactory.java +++ b/src/main/java/tech/jhipster/lite/generator/server/javatool/jacoco/domain/JacocoModuleFactory.java @@ -3,7 +3,6 @@ import static tech.jhipster.lite.module.domain.JHipsterModule.*; import static tech.jhipster.lite.module.domain.mavenplugin.MavenBuildPhase.*; -import java.util.regex.Pattern; import tech.jhipster.lite.module.domain.JHipsterModule; import tech.jhipster.lite.module.domain.gradleplugin.GradleMainBuildPlugin; import tech.jhipster.lite.module.domain.javabuild.ArtifactId; @@ -12,8 +11,6 @@ import tech.jhipster.lite.module.domain.mavenplugin.MavenPlugin; import tech.jhipster.lite.module.domain.mavenplugin.MavenPlugin.MavenPluginOptionalBuilder; import tech.jhipster.lite.module.domain.properties.JHipsterModuleProperties; -import tech.jhipster.lite.module.domain.replacement.ElementReplacer; -import tech.jhipster.lite.module.domain.replacement.RegexReplacer; import tech.jhipster.lite.shared.error.domain.Assert; public class JacocoModuleFactory { @@ -22,47 +19,6 @@ public class JacocoModuleFactory { private static final GroupId JACOCO_GROUP = groupId("org.jacoco"); private static final ArtifactId JACOCO_ARTIFACT_ID = artifactId("jacoco-maven-plugin"); private static final VersionSlug JACOCO_VERSION = versionSlug(JACOCO); - private static final Pattern BUILD_GRADLE_TASK_TEST_NEEDLE = Pattern.compile( - """ - tasks.test { - filter { - includeTestsMatching("**Test*") - excludeTestsMatching("**IT*") - excludeTestsMatching("**CucumberTest*") - } - useJUnitPlatform() - } - """, - Pattern.LITERAL - ); - private static final ElementReplacer EXISTING_BUILD_GRADLE_TASK_TEST_NEEDLE = new RegexReplacer( - (contentBeforeReplacement, replacement) -> BUILD_GRADLE_TASK_TEST_NEEDLE.matcher(contentBeforeReplacement).find(), - BUILD_GRADLE_TASK_TEST_NEEDLE - ); - private static final String ADD_JACOCO_BUILD_GRADLE_TASK_TEST = - """ - tasks.test { - filter { - includeTestsMatching("**Test*") - excludeTestsMatching("**IT*") - excludeTestsMatching("**CucumberTest*") - } - useJUnitPlatform() - finalizedBy("jacocoTestReport") - } - """; - private static final String ADD_JACOCO_WITH_MIN_COVERAGE_CHECK_BUILD_GRADLE_TASK_TEST = - """ - tasks.test { - filter { - includeTestsMatching("**Test*") - excludeTestsMatching("**IT*") - excludeTestsMatching("**CucumberTest*") - } - useJUnitPlatform() - finalizedBy("jacocoTestCoverageVerification") - } - """; public JHipsterModule buildJacocoModule(JHipsterModuleProperties properties) { Assert.notNull("properties", properties); @@ -76,11 +32,13 @@ public JHipsterModule buildJacocoModule(JHipsterModuleProperties properties) { .gradlePlugins() .plugin(gradleJacocoPlugin()) .and() - .optionalReplacements() - .in(path("build.gradle.kts")) - .add(EXISTING_BUILD_GRADLE_TASK_TEST_NEEDLE, ADD_JACOCO_BUILD_GRADLE_TASK_TEST) + .gradleConfigurations() + .addTasksTestInstruction( + """ + finalizedBy("jacocoTestReport")\ + """ + ) .and() - .and() .build(); //@formatter:on } @@ -97,11 +55,13 @@ public JHipsterModule buildJacocoWithMinCoverageCheckModule(JHipsterModuleProper .gradlePlugins() .plugin(gradleJacocoWithMinCoverageCheckPlugin()) .and() - .optionalReplacements() - .in(path("build.gradle.kts")) - .add(EXISTING_BUILD_GRADLE_TASK_TEST_NEEDLE, ADD_JACOCO_WITH_MIN_COVERAGE_CHECK_BUILD_GRADLE_TASK_TEST) + .gradleConfigurations() + .addTasksTestInstruction( + """ + finalizedBy("jacocoTestCoverageVerification")\ + """ + ) .and() - .and() .build(); //@formatter:on } diff --git a/src/test/java/tech/jhipster/lite/generator/server/javatool/jacoco/domain/JacocoModuleFactoryTest.java b/src/test/java/tech/jhipster/lite/generator/server/javatool/jacoco/domain/JacocoModuleFactoryTest.java index 26e406bc41a..76af50239d1 100644 --- a/src/test/java/tech/jhipster/lite/generator/server/javatool/jacoco/domain/JacocoModuleFactoryTest.java +++ b/src/test/java/tech/jhipster/lite/generator/server/javatool/jacoco/domain/JacocoModuleFactoryTest.java @@ -180,15 +180,8 @@ void shouldBuildJacocoModule() { ) .containing( """ - tasks.test { - filter { - includeTestsMatching("**Test*") - excludeTestsMatching("**IT*") - excludeTestsMatching("**CucumberTest*") - } - useJUnitPlatform() finalizedBy("jacocoTestReport") - } + // jhipster-needle-gradle-tasks-test """ ) .and() @@ -252,15 +245,8 @@ void shouldBuildJacocoWithMinCoverageCheckModule() { ) .containing( """ - tasks.test { - filter { - includeTestsMatching("**Test*") - excludeTestsMatching("**IT*") - excludeTestsMatching("**CucumberTest*") - } - useJUnitPlatform() finalizedBy("jacocoTestCoverageVerification") - } + // jhipster-needle-gradle-tasks-test """ ) .and() From 5e62f3573c5fb94df4cb2d7015f7dbf585af932f Mon Sep 17 00:00:00 2001 From: Renan Meneses de Andrade Franca Date: Wed, 15 May 2024 10:45:19 -0300 Subject: [PATCH 6/9] refactor JHipsterModuleGradleConfigurationBuilder from .configuration to .addConfiguration --- .../localeprofile/domain/LocalProfileModuleFactory.java | 2 +- .../gradleconfiguration/JHipsterModuleGradleConfigurations.java | 2 +- .../jhipster/lite/module/domain/JHipsterModulesFixture.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/tech/jhipster/lite/generator/server/springboot/localeprofile/domain/LocalProfileModuleFactory.java b/src/main/java/tech/jhipster/lite/generator/server/springboot/localeprofile/domain/LocalProfileModuleFactory.java index 9854e2690f6..db34bd4e639 100644 --- a/src/main/java/tech/jhipster/lite/generator/server/springboot/localeprofile/domain/LocalProfileModuleFactory.java +++ b/src/main/java/tech/jhipster/lite/generator/server/springboot/localeprofile/domain/LocalProfileModuleFactory.java @@ -25,7 +25,7 @@ public JHipsterModule buildModule(JHipsterModuleProperties properties) { .set(new PropertyKey(SPRING_PROFILES_ACTIVE), new PropertyValue("")) .and() .gradleConfigurations() - .configuration( + .addConfiguration( """ tasks.build { dependsOn("processResources") diff --git a/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/JHipsterModuleGradleConfigurations.java b/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/JHipsterModuleGradleConfigurations.java index 5a58cb5e697..58ca978b66b 100644 --- a/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/JHipsterModuleGradleConfigurations.java +++ b/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/JHipsterModuleGradleConfigurations.java @@ -59,7 +59,7 @@ private JHipsterModuleGradleConfigurationBuilder(JHipsterModuleBuilder module) { this.module = module; } - public JHipsterModuleGradleConfigurationBuilder configuration(String configuration) { + public JHipsterModuleGradleConfigurationBuilder addConfiguration(String configuration) { configurations.add(new GradleConfiguration(configuration)); return this; diff --git a/src/test/java/tech/jhipster/lite/module/domain/JHipsterModulesFixture.java b/src/test/java/tech/jhipster/lite/module/domain/JHipsterModulesFixture.java index 678c225056b..b84c6985430 100644 --- a/src/test/java/tech/jhipster/lite/module/domain/JHipsterModulesFixture.java +++ b/src/test/java/tech/jhipster/lite/module/domain/JHipsterModulesFixture.java @@ -100,7 +100,7 @@ public static JHipsterModule module() { .plugin(asciidoctorPlugin()) .and() .gradleConfigurations() - .configuration( + .addConfiguration( """ tasks.build { dependsOn("processResources") From 467fa5d7c5e1d9624182547b88c3ff2520387cf9 Mon Sep 17 00:00:00 2001 From: Renan Meneses de Andrade Franca Date: Wed, 15 May 2024 11:45:03 -0300 Subject: [PATCH 7/9] fix conflicts after merge --- .../gradle/GradleCommandHandlerTest.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandlerTest.java b/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandlerTest.java index d9afa099000..64a859cd32b 100644 --- a/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandlerTest.java +++ b/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandlerTest.java @@ -1,12 +1,14 @@ package tech.jhipster.lite.module.infrastructure.secondary.javadependency.gradle; import static org.assertj.core.api.Assertions.*; -import static org.junit.jupiter.params.provider.EnumSource.Mode.EXCLUDE; +import static org.junit.jupiter.params.provider.EnumSource.Mode.*; import static tech.jhipster.lite.TestFileUtils.*; import static tech.jhipster.lite.module.domain.JHipsterModule.*; import static tech.jhipster.lite.module.domain.JHipsterModulesFixture.*; -import java.nio.file.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.stream.Stream; import org.junit.jupiter.api.Nested; import org.junit.jupiter.api.Test; @@ -15,15 +17,22 @@ import org.junit.jupiter.params.provider.MethodSource; import tech.jhipster.lite.UnitTest; import tech.jhipster.lite.module.domain.Indentation; -import tech.jhipster.lite.module.domain.buildproperties.*; +import tech.jhipster.lite.module.domain.buildproperties.BuildProperty; +import tech.jhipster.lite.module.domain.buildproperties.PropertyKey; +import tech.jhipster.lite.module.domain.buildproperties.PropertyValue; import tech.jhipster.lite.module.domain.file.TemplateRenderer; import tech.jhipster.lite.module.domain.gradleplugin.GradlePlugin; import tech.jhipster.lite.module.domain.javabuild.command.*; import tech.jhipster.lite.module.domain.javabuildprofile.BuildProfileActivation; import tech.jhipster.lite.module.domain.javabuildprofile.BuildProfileId; -import tech.jhipster.lite.module.domain.javadependency.*; +import tech.jhipster.lite.module.domain.javadependency.JavaDependency; +import tech.jhipster.lite.module.domain.javadependency.JavaDependencyScope; +import tech.jhipster.lite.module.domain.javadependency.JavaDependencyType; +import tech.jhipster.lite.module.domain.javadependency.JavaDependencyVersion; import tech.jhipster.lite.module.domain.properties.JHipsterProjectFolder; -import tech.jhipster.lite.module.infrastructure.secondary.*; +import tech.jhipster.lite.module.infrastructure.secondary.FileSystemJHipsterModuleFiles; +import tech.jhipster.lite.module.infrastructure.secondary.FileSystemProjectFiles; +import tech.jhipster.lite.module.infrastructure.secondary.FileSystemReplacer; @UnitTest class GradleCommandHandlerTest { @@ -1519,7 +1528,7 @@ void shouldNotDuplicateExistingGradleFreeConfigurationBlock() { void shouldAddTasksTestInstruction() { JHipsterProjectFolder projectFolder = projectFrom("src/test/resources/projects/empty-gradle"); - new GradleCommandHandler(Indentation.DEFAULT, projectFolder, emptyModuleContext(), filesReader, templateRenderer).handle( + new GradleCommandHandler(Indentation.DEFAULT, projectFolder, emptyModuleContext(), files, fileReplacer).handle( new AddTasksTestInstruction( """ dependsOn("testNpm")\ @@ -1550,8 +1559,8 @@ void shouldNotDuplicateExistingTasksTestInstruction() { Indentation.DEFAULT, projectFolder, emptyModuleContext(), - filesReader, - templateRenderer + files, + fileReplacer ); gradleCommandHandler.handle( new AddTasksTestInstruction( From 00df9c37f0ed1d600bba9023e82fdc33309e10b0 Mon Sep 17 00:00:00 2001 From: Renan Franca Date: Thu, 16 May 2024 21:02:02 -0300 Subject: [PATCH 8/9] refactor by fixing Assert field name --- .../module/domain/javabuild/command/AddGradleConfiguration.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddGradleConfiguration.java b/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddGradleConfiguration.java index cca3046b4ec..dc4c78fbe27 100644 --- a/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddGradleConfiguration.java +++ b/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddGradleConfiguration.java @@ -4,7 +4,7 @@ public record AddGradleConfiguration(String configuration) implements JavaBuildCommand { public AddGradleConfiguration { - Assert.notNull("instruction", configuration); + Assert.notNull("configuration", configuration); } public String get() { From b860a68f0348aa77f3d0f4e1840a2e275da0b24b Mon Sep 17 00:00:00 2001 From: Renan Franca Date: Thu, 16 May 2024 21:02:17 -0300 Subject: [PATCH 9/9] refactor by rename record to use AddGradle prefix --- .../JHipsterModuleGradleConfigurations.java | 4 ++-- ...on.java => AddGradleTasksTestInstruction.java} | 4 ++-- .../javabuild/command/JavaBuildCommand.java | 2 +- .../FileSystemJavaBuildCommandsHandler.java | 2 +- .../JavaDependenciesCommandHandler.java | 2 +- .../gradle/GradleCommandHandler.java | 15 +++++++++------ .../javadependency/maven/MavenCommandHandler.java | 2 +- .../gradle/GradleCommandHandlerTest.java | 6 +++--- 8 files changed, 20 insertions(+), 17 deletions(-) rename src/main/java/tech/jhipster/lite/module/domain/javabuild/command/{AddTasksTestInstruction.java => AddGradleTasksTestInstruction.java} (62%) diff --git a/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/JHipsterModuleGradleConfigurations.java b/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/JHipsterModuleGradleConfigurations.java index 58ca978b66b..040321f040c 100644 --- a/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/JHipsterModuleGradleConfigurations.java +++ b/src/main/java/tech/jhipster/lite/module/domain/gradleconfiguration/JHipsterModuleGradleConfigurations.java @@ -6,7 +6,7 @@ import java.util.stream.Stream; import tech.jhipster.lite.module.domain.JHipsterModule.JHipsterModuleBuilder; import tech.jhipster.lite.module.domain.javabuild.command.AddGradleConfiguration; -import tech.jhipster.lite.module.domain.javabuild.command.AddTasksTestInstruction; +import tech.jhipster.lite.module.domain.javabuild.command.AddGradleTasksTestInstruction; import tech.jhipster.lite.module.domain.javabuild.command.JavaBuildCommands; import tech.jhipster.lite.shared.error.domain.Assert; @@ -42,7 +42,7 @@ private Stream configurationToAddGradleConfiguration() { private Stream tasksTestInstructionsToAddTasksTestInstruction() { return Stream.of( new JavaBuildCommands( - tasksTestInstructions.stream().map(tasksTestInstruction -> new AddTasksTestInstruction(tasksTestInstruction.get())).toList() + tasksTestInstructions.stream().map(tasksTestInstruction -> new AddGradleTasksTestInstruction(tasksTestInstruction.get())).toList() ) ); } diff --git a/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddTasksTestInstruction.java b/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddGradleTasksTestInstruction.java similarity index 62% rename from src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddTasksTestInstruction.java rename to src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddGradleTasksTestInstruction.java index cb16a7f3d37..beba3b81f6d 100644 --- a/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddTasksTestInstruction.java +++ b/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/AddGradleTasksTestInstruction.java @@ -2,8 +2,8 @@ import tech.jhipster.lite.shared.error.domain.Assert; -public record AddTasksTestInstruction(String instruction) implements JavaBuildCommand { - public AddTasksTestInstruction { +public record AddGradleTasksTestInstruction(String instruction) implements JavaBuildCommand { + public AddGradleTasksTestInstruction { Assert.notNull("instruction", instruction); } diff --git a/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/JavaBuildCommand.java b/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/JavaBuildCommand.java index 1d7054c1f42..a5d66b2dd17 100644 --- a/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/JavaBuildCommand.java +++ b/src/main/java/tech/jhipster/lite/module/domain/javabuild/command/JavaBuildCommand.java @@ -14,4 +14,4 @@ public sealed interface JavaBuildCommand SetBuildProperty, SetVersion, AddGradleConfiguration, - AddTasksTestInstruction {} + AddGradleTasksTestInstruction {} diff --git a/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/FileSystemJavaBuildCommandsHandler.java b/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/FileSystemJavaBuildCommandsHandler.java index 519bb1d5eeb..589e2b8069a 100644 --- a/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/FileSystemJavaBuildCommandsHandler.java +++ b/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/FileSystemJavaBuildCommandsHandler.java @@ -80,7 +80,7 @@ private void handle(JavaDependenciesCommandHandler handler, JavaBuildCommand com case AddJavaBuildProfile addJavaBuildProfile -> handler.handle(addJavaBuildProfile); case AddGradlePlugin addGradlePlugin -> handler.handle(addGradlePlugin); case AddGradleConfiguration addGradleConfiguration -> handler.handle(addGradleConfiguration); - case AddTasksTestInstruction addTasksTestInstruction -> handler.handle(addTasksTestInstruction); + case AddGradleTasksTestInstruction addGradleTasksTestInstruction -> handler.handle(addGradleTasksTestInstruction); } } } diff --git a/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/JavaDependenciesCommandHandler.java b/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/JavaDependenciesCommandHandler.java index 6c239e76eec..22f911ff035 100644 --- a/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/JavaDependenciesCommandHandler.java +++ b/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/JavaDependenciesCommandHandler.java @@ -27,5 +27,5 @@ public interface JavaDependenciesCommandHandler { void handle(AddGradleConfiguration command); - void handle(AddTasksTestInstruction command); + void handle(AddGradleTasksTestInstruction command); } diff --git a/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandler.java b/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandler.java index a39edba11e7..35b0f5a3b98 100644 --- a/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandler.java +++ b/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandler.java @@ -1,20 +1,23 @@ package tech.jhipster.lite.module.infrastructure.secondary.javadependency.gradle; import static tech.jhipster.lite.module.domain.JHipsterModule.*; -import static tech.jhipster.lite.module.domain.replacement.ReplacementCondition.always; -import static tech.jhipster.lite.module.infrastructure.secondary.javadependency.gradle.VersionsCatalog.libraryAlias; -import static tech.jhipster.lite.module.infrastructure.secondary.javadependency.gradle.VersionsCatalog.pluginAlias; +import static tech.jhipster.lite.module.domain.replacement.ReplacementCondition.*; +import static tech.jhipster.lite.module.infrastructure.secondary.javadependency.gradle.VersionsCatalog.*; import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; -import java.util.*; +import java.util.Arrays; +import java.util.List; +import java.util.Optional; import java.util.function.Predicate; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; -import tech.jhipster.lite.module.domain.*; +import tech.jhipster.lite.module.domain.Indentation; +import tech.jhipster.lite.module.domain.JHipsterModuleContext; +import tech.jhipster.lite.module.domain.JHipsterProjectFilePath; import tech.jhipster.lite.module.domain.buildproperties.BuildProperty; import tech.jhipster.lite.module.domain.buildproperties.PropertyKey; import tech.jhipster.lite.module.domain.file.*; @@ -530,7 +533,7 @@ public void handle(AddGradleConfiguration command) { } @Override - public void handle(AddTasksTestInstruction command) { + public void handle(AddGradleTasksTestInstruction command) { MandatoryReplacer replacer = new MandatoryReplacer( new RegexNeedleBeforeReplacer( (contentBeforeReplacement, newText) -> !contentBeforeReplacement.contains(newText), diff --git a/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/maven/MavenCommandHandler.java b/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/maven/MavenCommandHandler.java index 9b0fae9183f..3263087aecc 100644 --- a/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/maven/MavenCommandHandler.java +++ b/src/main/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/maven/MavenCommandHandler.java @@ -346,7 +346,7 @@ public void handle(AddGradleConfiguration command) { } @Override - public void handle(AddTasksTestInstruction command) { + public void handle(AddGradleTasksTestInstruction command) { // Gradle commands are ignored } diff --git a/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandlerTest.java b/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandlerTest.java index 64a859cd32b..6c4fe709cd7 100644 --- a/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandlerTest.java +++ b/src/test/java/tech/jhipster/lite/module/infrastructure/secondary/javadependency/gradle/GradleCommandHandlerTest.java @@ -1529,7 +1529,7 @@ void shouldAddTasksTestInstruction() { JHipsterProjectFolder projectFolder = projectFrom("src/test/resources/projects/empty-gradle"); new GradleCommandHandler(Indentation.DEFAULT, projectFolder, emptyModuleContext(), files, fileReplacer).handle( - new AddTasksTestInstruction( + new AddGradleTasksTestInstruction( """ dependsOn("testNpm")\ """ @@ -1563,7 +1563,7 @@ void shouldNotDuplicateExistingTasksTestInstruction() { fileReplacer ); gradleCommandHandler.handle( - new AddTasksTestInstruction( + new AddGradleTasksTestInstruction( """ dependsOn("testNpm")\ """ @@ -1571,7 +1571,7 @@ void shouldNotDuplicateExistingTasksTestInstruction() { ); gradleCommandHandler.handle( - new AddTasksTestInstruction( + new AddGradleTasksTestInstruction( """ dependsOn("testNpm")\ """