This is an automated email from the ASF dual-hosted git repository. slachiewicz pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/maven-wrapper.git
commit c726abd2a09da7ff051aead87da65a2ba7a1f932 Author: Sylwester Lachiewicz <[email protected]> AuthorDate: Tue Nov 17 08:22:21 2026 +0000 Use JUnit 5 assertions and Mockito best practices in tests --- .../src/test/java/org/apache/maven/wrapper/InstallerTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maven-wrapper/src/test/java/org/apache/maven/wrapper/InstallerTest.java b/maven-wrapper/src/test/java/org/apache/maven/wrapper/InstallerTest.java index 04731ea..1f346bc 100644 --- a/maven-wrapper/src/test/java/org/apache/maven/wrapper/InstallerTest.java +++ b/maven-wrapper/src/test/java/org/apache/maven/wrapper/InstallerTest.java @@ -23,7 +23,6 @@ import java.io.File; import java.io.IOException; import java.io.OutputStream; import java.net.URI; -import java.net.URISyntaxException; import java.net.URL; import java.nio.charset.StandardCharsets; import java.nio.file.FileVisitResult; @@ -45,6 +44,7 @@ import org.junit.jupiter.api.io.TempDir; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.junit.jupiter.api.Assertions.fail; import static org.mockito.Mockito.mock; @@ -210,7 +210,7 @@ public class InstallerTest { } @Test - void testZipSlip() throws URISyntaxException { + void testZipSlip() throws Exception { URL resource = getClass().getClassLoader().getResource("zip-slip.zip"); Path zipSlip = Paths.get(resource.toURI()); when(localDistribution.getZipFile()).thenReturn(zipSlip); @@ -220,7 +220,7 @@ public class InstallerTest { install.createDist(configuration); fail("Should fail as it contains a zip slip."); } catch (Exception ex) { - assertTrue(ex instanceof ZipException); + assertInstanceOf(ZipException.class, ex); } }
