slachiewicz commented on code in PR #2338:
URL: https://github.com/apache/maven-resolver/pull/2338#discussion_r4648655803


##########
maven-resolver-util/src/test/java/org/eclipse/aether/util/DirectoryUtilsTest.java:
##########
@@ -19,40 +19,41 @@
 package org.eclipse.aether.util;
 
 import java.io.IOException;
+import java.lang.reflect.Method;
 import java.nio.file.FileSystems;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
+import java.util.Optional;
 
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.TestName;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.TestInfo;
 
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalTo;
-import static org.hamcrest.Matchers.startsWith;
-import static org.junit.Assume.assumeTrue;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assumptions.assumeTrue;
 
 public class DirectoryUtilsTest {
-    @Rule
-    public TestName testName = new TestName();
+
+    private String testName;
 
     @Test
     public void expectedCasesRelative() throws IOException {
         // hack for surefire: sets the property but directory may not exist
         
Files.createDirectories(Paths.get(System.getProperty("java.io.tmpdir")));
 
-        Path tmpDir = Files.createTempDirectory(testName.getMethodName());
+        Path tmpDir = Files.createTempDirectory(testName);
         Path result;
 
         result = DirectoryUtils.resolveDirectory("foo", tmpDir, false);
-        assertThat(result, equalTo(tmpDir.resolve("foo")));
+        assertEquals(result, tmpDir.resolve("foo"));

Review Comment:
   Fixed in 3f8b04b — all eight assertions now use the JUnit 5 `(expected, 
actual)` order. Good catch; the reversed order was copied from the 
already-migrated master version of this file, which has the same wart (worth 
fixing there separately).



##########
maven-resolver-util/src/test/java/org/eclipse/aether/util/DirectoryUtilsTest.java:
##########
@@ -110,10 +111,18 @@ public void notExistsAndIsCreated() throws IOException {
         // hack for surefire: sets the property but directory may not exist
         
Files.createDirectories(Paths.get(System.getProperty("java.io.tmpdir")));
 
-        Path tmpDir = Files.createTempDirectory(testName.getMethodName());
+        Path tmpDir = Files.createTempDirectory(testName);
         Files.createDirectories(tmpDir.resolve("foo"));
         Path result = DirectoryUtils.resolveDirectory("foo", tmpDir, true);
-        assertThat(result, equalTo(tmpDir.resolve("foo")));
-        assertThat(Files.isDirectory(tmpDir.resolve("foo")), equalTo(true));
+        assertEquals(result, tmpDir.resolve("foo"));
+        assertEquals(Files.isDirectory(tmpDir.resolve("foo")), true);

Review Comment:
   Fixed in 3f8b04b — replaced with 
`assertTrue(Files.isDirectory(tmpDir.resolve("foo")))`.



-- 
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]

Reply via email to