Skip to content

Commit 18ed2c7

Browse files
committed
Remove test for invalid multiple-argLine configuration
1 parent 8961fa8 commit 18ed2c7

2 files changed

Lines changed: 3 additions & 107 deletions

File tree

src/main/java/org/openrewrite/java/migrate/AddMockitoJavaAgentToMavenSurefirePlugin.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,9 @@ public Xml.Tag visitTag(Xml.Tag tag, ExecutionContext ctx) {
160160
return autoFormat(t.withContent(ListUtils.map(pluginContents, c -> c == config ? updatedConfig : c)), ctx);
161161
}
162162
}
163-
// Any remaining case needs no surefire change: either the single argLine already
164-
// contains the agent, or there are multiple <argLine> tags. Multiple tags are an
165-
// ambiguous configuration, since surefire's argLine is single-valued and only the
166-
// first tag is honored; appending another would be silently ignored, so we leave
167-
// the configuration untouched rather than guess which argLine to augment.
163+
// No surefire change needed: the single argLine already contains the agent, or
164+
// there are multiple <argLine> tags (an invalid configuration, since surefire's
165+
// argLine is single-valued) that we leave untouched.
168166
return t;
169167
}
170168
});

src/test/java/org/openrewrite/java/migrate/AddMockitoJavaAgentToMavenSurefirePluginTest.java

Lines changed: 0 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -977,108 +977,6 @@ void addsPropertiesGoalToExistingGoalsSectionInMavenDependencyPlugin() {
977977
);
978978
}
979979

980-
@Test
981-
void addsArgLineAndPluginsButMakesNoAgentChangesIfMultipleArgLineTagsExist() {
982-
rewriteRun(
983-
mavenProject("test-project",
984-
pomXml(
985-
"""
986-
<project>
987-
<modelVersion>4.0.0</modelVersion>
988-
<groupId>org.sample</groupId>
989-
<artifactId>test</artifactId>
990-
<version>${revision}</version>
991-
992-
<parent>
993-
<groupId>org.springframework.boot</groupId>
994-
<artifactId>spring-boot-starter-parent</artifactId>
995-
<version>3.5.4</version>
996-
<relativePath/>
997-
</parent>
998-
999-
<dependencies>
1000-
<dependency>
1001-
<groupId>org.springframework.boot</groupId>
1002-
<artifactId>spring-boot-starter-test</artifactId>
1003-
<scope>test</scope>
1004-
</dependency>
1005-
</dependencies>
1006-
<build>
1007-
<plugins>
1008-
<plugin>
1009-
<groupId>org.apache.maven.plugins</groupId>
1010-
<artifactId>maven-surefire-plugin</artifactId>
1011-
<configuration>
1012-
<systemPropertyVariables>
1013-
<propertyName>foobar</propertyName>
1014-
</systemPropertyVariables>
1015-
<argLine>-Duser.language=en</argLine>
1016-
<argLine>-Xmx256m</argLine>
1017-
<argLine>-XX:MaxPermSize=256m</argLine>
1018-
</configuration>
1019-
</plugin>
1020-
</plugins>
1021-
</build>
1022-
</project>
1023-
""",
1024-
"""
1025-
<project>
1026-
<modelVersion>4.0.0</modelVersion>
1027-
<groupId>org.sample</groupId>
1028-
<artifactId>test</artifactId>
1029-
<version>${revision}</version>
1030-
1031-
<parent>
1032-
<groupId>org.springframework.boot</groupId>
1033-
<artifactId>spring-boot-starter-parent</artifactId>
1034-
<version>3.5.4</version>
1035-
<relativePath/>
1036-
</parent>
1037-
<properties>
1038-
<argLine></argLine>
1039-
</properties>
1040-
1041-
<dependencies>
1042-
<dependency>
1043-
<groupId>org.springframework.boot</groupId>
1044-
<artifactId>spring-boot-starter-test</artifactId>
1045-
<scope>test</scope>
1046-
</dependency>
1047-
</dependencies>
1048-
<build>
1049-
<plugins>
1050-
<plugin>
1051-
<groupId>org.apache.maven.plugins</groupId>
1052-
<artifactId>maven-surefire-plugin</artifactId>
1053-
<configuration>
1054-
<systemPropertyVariables>
1055-
<propertyName>foobar</propertyName>
1056-
</systemPropertyVariables>
1057-
<argLine>-Duser.language=en</argLine>
1058-
<argLine>-Xmx256m</argLine>
1059-
<argLine>-XX:MaxPermSize=256m</argLine>
1060-
</configuration>
1061-
</plugin>
1062-
<plugin>
1063-
<groupId>org.apache.maven.plugins</groupId>
1064-
<artifactId>maven-dependency-plugin</artifactId>
1065-
<executions>
1066-
<execution>
1067-
<goals>
1068-
<goal>properties</goal>
1069-
</goals>
1070-
</execution>
1071-
</executions>
1072-
</plugin>
1073-
</plugins>
1074-
</build>
1075-
</project>
1076-
"""
1077-
)
1078-
)
1079-
);
1080-
}
1081-
1082980
@Test
1083981
void makesNoChangeWhenMockitoAgentFlagAlreadyExists() {
1084982
rewriteRun(

0 commit comments

Comments
 (0)