You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "slawekjaranowski (via GitHub)" <gi...@apache.org> on 2026/02/13 22:31:37 UTC
[PR] Migrate to JUnit5 - avoid using AbstractMojoTestCase [maven-project-info-reports-plugin]
slawekjaranowski opened a new pull request, #619:
URL: https://github.com/apache/maven-project-info-reports-plugin/pull/619
Following this checklist to help us incorporate your
contribution quickly and easily:
- [ ] Your pull request should address just one issue, without pulling in other changes.
- [ ] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
- [ ] Each commit in the pull request should have a meaningful subject line and body.
Note that commits might be squashed by a maintainer on merge.
- [ ] Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
This may not always be possible but is a best-practice.
- [ ] Run `mvn verify` to make sure basic checks pass.
A more thorough check will be performed on your pull request automatically.
- [ ] You have run the integration tests successfully (`mvn -Prun-its verify`).
If your pull request is about ~20 lines of code you don't need to sign an
[Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf) if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
you have to acknowledge this by using the following check-box.
- [ ] I hereby declare this contribution to be licenced under the [Apache License Version 2.0, January 2004](http://www.apache.org/licenses/LICENSE-2.0)
- [ ] In any other case, please file an [Apache Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate to JUnit5 - avoid using AbstractMojoTestCase [maven-project-info-reports-plugin]
Posted by "Bukama (via GitHub)" <gi...@apache.org>.
Bukama commented on code in PR #619:
URL: https://github.com/apache/maven-project-info-reports-plugin/pull/619#discussion_r2807917770
##########
pom.xml:
##########
@@ -173,17 +178,6 @@ under the License.
<artifactId>maven-dependency-tree</artifactId>
<version>3.3.0</version>
</dependency>
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-shared-utils</artifactId>
- <version>3.4.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-shared-jar</artifactId>
Review Comment:
Unsure why you moved this out of the section declared as `Maven`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate to JUnit5 - avoid using AbstractMojoTestCase [maven-project-info-reports-plugin]
Posted by "Bukama (via GitHub)" <gi...@apache.org>.
Bukama commented on code in PR #619:
URL: https://github.com/apache/maven-project-info-reports-plugin/pull/619#discussion_r2807904023
##########
src/test/java/org/apache/maven/report/projectinfo/DependenciesReportTest.java:
##########
@@ -26,35 +28,62 @@
import com.meterware.httpunit.WebRequest;
import com.meterware.httpunit.WebResponse;
import com.meterware.httpunit.WebTable;
+import org.apache.maven.api.plugin.testing.Basedir;
+import org.apache.maven.api.plugin.testing.InjectMojo;
+import org.apache.maven.api.plugin.testing.MojoTest;
+import org.apache.maven.execution.MavenSession;
+import org.apache.maven.project.DefaultProjectBuildingRequest;
+import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
+import static org.apache.maven.api.plugin.testing.MojoExtension.getTestFile;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
/**
* @author Edwin Punzalan
* @author <a href="mailto:vincent.siveton@gmail.com">Vincent Siveton</a>
* @version $Id$
*/
-public class DependenciesReportTest extends AbstractProjectInfoTestCase {
+@MojoTest(realRepositorySession = true)
+@Basedir("/plugin-configs")
+class DependenciesReportTest extends AbstractProjectInfoTest {
+
+ @Inject
+ private MavenSession mavenSession;
+
/**
* WebConversation object
*/
private static final WebConversation WEB_CONVERSATION = new WebConversation();
+ @BeforeEach
+ void setup() throws Exception {
+ DefaultProjectBuildingRequest pbr = spy(new DefaultProjectBuildingRequest());
+ doAnswer(__ -> mavenSession.getRepositorySession()).when(pbr).getRepositorySession();
+ when(mavenSession.getProjectBuildingRequest()).thenReturn(pbr);
+ readMavenProjectModel(mavenProject, "dependencies-plugin-config.xml");
+ setArtifactForProject(mavenProject);
+ }
+
/**
* Test report
*
* @throws Exception if any
*/
@Test
- public void testReport() throws Exception {
- generateReport(getGoal(), "dependencies-plugin-config.xml");
- org.junit.jupiter.api.Assertions.assertTrue(
- getGeneratedReport("dependencies.html").exists(), "Test html generated");
+ @InjectMojo(goal = "dependencies", pom = "dependencies-plugin-config.xml")
+ void testReport(DependenciesReport mojo) throws Exception {
+ mojo.execute();
+
+ URL reportURL =
+ getTestFile("target/dependencies/dependencies.html").toURI().toURL();
- URL reportURL = getGeneratedReport("dependencies.html").toURI().toURL();
+ // URL reportURL = ("dependencies.html").toURI().toURL();
Review Comment:
Delete this line
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate to JUnit5 - avoid using AbstractMojoTestCase [maven-project-info-reports-plugin]
Posted by "Bukama (via GitHub)" <gi...@apache.org>.
Bukama commented on code in PR #619:
URL: https://github.com/apache/maven-project-info-reports-plugin/pull/619#discussion_r2807913945
##########
src/test/java/org/apache/maven/report/projectinfo/PluginManagementReportTest.java:
##########
@@ -117,12 +134,15 @@ public void testReport() throws Exception {
* @throws Exception if any
*/
@Test
- public void testReportEclipseM2EPluginLifecycleMapping() throws Exception {
- generateReport(getGoal(), "plugin-management-plugin-config-MPIR-375.xml");
- org.junit.jupiter.api.Assertions.assertTrue(
- getGeneratedReport("plugin-management.html").exists(), "Test html generated");
-
- URL reportURL = getGeneratedReport("plugin-management.html").toURI().toURL();
+ @InjectMojo(goal = "plugin-management", pom = "plugin-management-plugin-config-MPIR-375.xml")
+ public void testReportEclipseM2EPluginLifecycleMapping(PluginManagementReport mojo) throws Exception {
+ readMavenProjectModel(mavenProject, "plugin-management-plugin-config-MPIR-375.xml");
+ mojo.execute();
+
+ URL reportURL = getTestFile("target/plugin-management-375/plugin-management.html")
+ .toURI()
+ .toURL();
+ // URL reportURL = getGeneratedReport("plugin-management.html").toURI().toURL();
Review Comment:
remove
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate to JUnit5 - avoid using AbstractMojoTestCase [maven-project-info-reports-plugin]
Posted by "slawekjaranowski (via GitHub)" <gi...@apache.org>.
slawekjaranowski merged PR #619:
URL: https://github.com/apache/maven-project-info-reports-plugin/pull/619
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate to JUnit5 - avoid using AbstractMojoTestCase [maven-project-info-reports-plugin]
Posted by "slawekjaranowski (via GitHub)" <gi...@apache.org>.
slawekjaranowski commented on code in PR #619:
URL: https://github.com/apache/maven-project-info-reports-plugin/pull/619#discussion_r2808969249
##########
pom.xml:
##########
@@ -173,17 +178,6 @@ under the License.
<artifactId>maven-dependency-tree</artifactId>
<version>3.3.0</version>
</dependency>
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-shared-utils</artifactId>
- <version>3.4.2</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.maven.shared</groupId>
- <artifactId>maven-shared-jar</artifactId>
Review Comment:
due to transitive dependencies on commons-lang3 I need to move it upper to have newer version
After test changed, new path of code is starting to executing
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Migrate to JUnit5 - avoid using AbstractMojoTestCase [maven-project-info-reports-plugin]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #619:
URL: https://github.com/apache/maven-project-info-reports-plugin/pull/619#issuecomment-3904100138
@slawekjaranowski Please assign appropriate label to PR according to the type of change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@maven.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org