manandbytes commented on code in PR #399:
URL: https://github.com/apache/maven-wrapper/pull/399#discussion_r2765580778
##########
maven-wrapper-plugin/src/test/java/org/apache/maven/plugins/wrapper/WrapperMojoTest.java:
##########
@@ -18,62 +18,68 @@
*/
package org.apache.maven.plugins.wrapper;
-import org.apache.maven.settings.Settings;
+import org.eclipse.aether.RepositorySystem;
+import org.eclipse.aether.RepositorySystemSession;
import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.InjectMocks;
+import org.mockito.junit.jupiter.MockitoExtension;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyList;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+@ExtendWith(MockitoExtension.class)
class WrapperMojoTest {
+ private final RepositorySystem repositorySystem;
Review Comment:
To fully utilize Mockito Extension, IIRC:
- `@org.mockito.Mock` on non-final `RepositorySystem` and
`mockRepositorySystemSession`
- no need to initialize `wrapperMojo`
- `@BeforeEach void setUp`
- `WrapperMojoTest()` should became `@BeforeEach void setUp()`, methodname
could be any
But this would fail `userSuppliedRepoUrlGetsTrailingSlashTrimmed` with:
```
org.mockito.exceptions.misusing.UnnecessaryStubbingException:
Unnecessary stubbings detected.
Clean & maintainable test code requires zero unnecessary code.
Following stubbings are unnecessary (click to navigate to relevant line of
code):
1. -> at
org.apache.maven.plugins.wrapper.WrapperMojoTest.setUp(WrapperMojoTest.java:45)
Please remove unnecessary stubbings or use 'lenient' strictness. More info:
javadoc for UnnecessaryStubbingException class.
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]