This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch plexus1
in repository https://gitbox.apache.org/repos/asf/maven-wagon.git
The following commit(s) were added to refs/heads/plexus1 by this push:
new 309c0845 junit5
309c0845 is described below
commit 309c084573c60fb6c2bbd0823d87158c65a78636
Author: Sylwester Lachiewicz <[email protected]>
AuthorDate: Sat Dec 13 23:45:56 2025 +0100
junit5
---
wagon-provider-api/pom.xml | 4 +-
.../org/apache/maven/wagon/AbstractWagonTest.java | 82 +++++++++++++---------
.../maven/wagon/CannotConnectExceptionTest.java | 9 ++-
.../maven/wagon/LazyFileOutputStreamTest.java | 10 ++-
.../maven/wagon/NotAuthorizedExceptionTest.java | 9 ++-
.../java/org/apache/maven/wagon/PathUtilsTest.java | 63 +++++++++++------
.../maven/wagon/PermissionModeUtilsTest.java | 9 ++-
.../wagon/ResourceDoesNotExistExceptionTest.java | 9 ++-
.../org/apache/maven/wagon/StreamWagonTest.java | 66 ++++++++++-------
.../maven/wagon/TransferFailedExceptionTest.java | 9 ++-
.../AuthenticationExceptionTest.java | 26 ++-----
.../authentication/AuthenticationInfoTest.java | 20 +++---
.../wagon/events/SessionEventSupportTest.java | 40 +++++++----
.../maven/wagon/events/SessionEventTest.java | 18 ++---
.../wagon/events/TransferEventSupportTest.java | 31 +++++---
.../maven/wagon/events/TransferEventTest.java | 19 ++---
.../wagon/observers/ChecksumObserverTest.java | 32 ++++-----
.../apache/maven/wagon/proxy/ProxyInfoTest.java | 20 +++---
.../maven/wagon/proxy/ProxyInfoUtilsTest.java | 45 +++++++-----
.../repository/RepositoryPermissionsTest.java | 20 +++---
.../maven/wagon/repository/RepositoryTest.java | 13 ++--
21 files changed, 323 insertions(+), 231 deletions(-)
diff --git a/wagon-provider-api/pom.xml b/wagon-provider-api/pom.xml
index 61da2286..ac79d286 100644
--- a/wagon-provider-api/pom.xml
+++ b/wagon-provider-api/pom.xml
@@ -37,8 +37,8 @@ under the License.
<scope>test</scope>
</dependency>
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/AbstractWagonTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/AbstractWagonTest.java
index 463ead3f..75e2aed3 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/AbstractWagonTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/AbstractWagonTest.java
@@ -20,11 +20,9 @@
import java.io.ByteArrayOutputStream;
import java.io.File;
-import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
-import junit.framework.TestCase;
import org.apache.maven.wagon.authentication.AuthenticationException;
import org.apache.maven.wagon.authentication.AuthenticationInfo;
import org.apache.maven.wagon.authorization.AuthorizationException;
@@ -38,13 +36,16 @@
import org.apache.maven.wagon.repository.RepositoryPermissions;
import org.apache.maven.wagon.resource.Resource;
import org.easymock.IAnswer;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.easymock.EasyMock.*;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author <a href="[email protected]">Michal Maczka</a>
*/
-public class AbstractWagonTest extends TestCase {
+class AbstractWagonTest {
private static class TestWagon extends AbstractWagon {
@Override
protected void closeConnection() throws ConnectionException {}
@@ -81,8 +82,8 @@ public void put(File source, String destination)
private TransferListener transferListener = null;
- protected void setUp() throws Exception {
- super.setUp();
+ @BeforeEach
+ void setUp() throws Exception {
basedir = System.getProperty("basedir");
@@ -101,7 +102,8 @@ protected void setUp() throws Exception {
wagon.addTransferListener(transferListener);
}
- public void testCalculationOfTransferBufferSize() {
+ @Test
+ void calculationOfTransferBufferSize() {
// 1 KiB -> Default buffer size (4 KiB)
assertEquals(4096, wagon.getBufferCapacityForTransfer(1024L));
@@ -118,7 +120,8 @@ public void testCalculationOfTransferBufferSize() {
assertEquals(4096 * 128, wagon.getBufferCapacityForTransfer(1024L *
1024 * 1024 * 100));
}
- public void testSessionListenerRegistration() {
+ @Test
+ void sessionListenerRegistration() {
assertTrue(wagon.hasSessionListener(sessionListener));
wagon.removeSessionListener(sessionListener);
@@ -126,7 +129,8 @@ public void testSessionListenerRegistration() {
assertFalse(wagon.hasSessionListener(sessionListener));
}
- public void testTransferListenerRegistration() {
+ @Test
+ void transferListenerRegistration() {
assertTrue(wagon.hasTransferListener(transferListener));
wagon.removeTransferListener(transferListener);
@@ -134,7 +138,8 @@ public void testTransferListenerRegistration() {
assertFalse(wagon.hasTransferListener(transferListener));
}
- public void testNoProxyConfiguration() throws ConnectionException,
AuthenticationException {
+ @Test
+ void noProxyConfiguration() throws Exception {
Repository repository = new Repository("fake", "http://fake");
wagon.connect(repository);
assertNull(wagon.getProxyInfo());
@@ -145,7 +150,8 @@ public void testNoProxyConfiguration() throws
ConnectionException, Authenticatio
assertNull(wagon.getProxyInfo("http", "localhost"));
}
- public void testNullProxyConfiguration() throws ConnectionException,
AuthenticationException {
+ @Test
+ void nullProxyConfiguration() throws Exception {
Repository repository = new Repository("fake", "http://fake");
wagon.connect(repository, (ProxyInfo) null);
assertNull(wagon.getProxyInfo());
@@ -172,7 +178,8 @@ public void testNullProxyConfiguration() throws
ConnectionException, Authenticat
assertNull(wagon.getProxyInfo("http", "localhost"));
}
- public void testLegacyProxyConfiguration() throws ConnectionException,
AuthenticationException {
+ @Test
+ void legacyProxyConfiguration() throws Exception {
ProxyInfo proxyInfo = new ProxyInfo();
proxyInfo.setType("http");
@@ -185,7 +192,8 @@ public void testLegacyProxyConfiguration() throws
ConnectionException, Authentic
assertNull(wagon.getProxyInfo("ftp", "www.example.com"));
}
- public void testProxyConfiguration() throws ConnectionException,
AuthenticationException {
+ @Test
+ void proxyConfiguration() throws Exception {
final ProxyInfo httpProxyInfo = new ProxyInfo();
httpProxyInfo.setType("http");
@@ -210,7 +218,8 @@ public void testProxyConfiguration() throws
ConnectionException, AuthenticationE
assertNull(wagon.getProxyInfo("ftp", "www.example.com"));
}
- public void testSessionOpenEvents() throws Exception {
+ @Test
+ void sessionOpenEvents() throws Exception {
Repository repository = new Repository("fake", "http://fake");
sessionListener.sessionOpening(anyObject(SessionEvent.class));
@@ -224,25 +233,25 @@ public void testSessionOpenEvents() throws Exception {
assertEquals(repository, wagon.getRepository());
}
- public void testSessionConnectionRefusedEventConnectionException() throws
Exception {
+ @Test
+ void sessionConnectionRefusedEventConnectionException() throws Exception {
final WagonException exception = new ConnectionException("");
try {
runTestSessionConnectionRefusedEvent(exception);
fail();
} catch (ConnectionException e) {
- assertTrue(true);
}
}
- public void testSessionConnectionRefusedEventAuthenticationException()
throws Exception {
+ @Test
+ void sessionConnectionRefusedEventAuthenticationException() throws
Exception {
final WagonException exception = new AuthenticationException("");
try {
runTestSessionConnectionRefusedEvent(exception);
fail();
} catch (AuthenticationException e) {
- assertTrue(true);
}
}
@@ -277,7 +286,8 @@ protected void openConnectionInternal() throws
ConnectionException, Authenticati
}
}
- public void testSessionCloseEvents() throws Exception {
+ @Test
+ void sessionCloseEvents() throws Exception {
sessionListener.sessionDisconnecting(anyObject(SessionEvent.class));
sessionListener.sessionDisconnected(anyObject(SessionEvent.class));
replay(sessionListener);
@@ -287,7 +297,8 @@ public void testSessionCloseEvents() throws Exception {
verify(sessionListener);
}
- public void testSessionCloseRefusedEventConnectionException() throws
Exception {
+ @Test
+ void sessionCloseRefusedEventConnectionException() throws Exception {
sessionListener.sessionDisconnecting(anyObject(SessionEvent.class));
sessionListener.sessionError(anyObject(SessionEvent.class));
replay(sessionListener);
@@ -304,13 +315,13 @@ protected void closeConnection() throws
ConnectionException {
wagon.disconnect();
fail();
} catch (ConnectionException e) {
- assertTrue(true);
} finally {
verify(sessionListener);
}
}
- public void testGetTransferEvents() throws Exception {
+ @Test
+ void getTransferEvents() throws Exception {
transferListener.debug("fetch debug message");
transferListener.transferInitiated(anyObject(TransferEvent.class));
transferListener.transferStarted(anyObject(TransferEvent.class));
@@ -331,7 +342,8 @@ public void testGetTransferEvents() throws Exception {
verify(transferListener);
}
- public void testGetError() throws Exception {
+ @Test
+ void getError() throws Exception {
transferListener.transferInitiated(anyObject(TransferEvent.class));
transferListener.transferStarted(anyObject(TransferEvent.class));
transferListener.debug(anyString());
@@ -352,15 +364,14 @@ public void testGetError() throws Exception {
fail("Transfer error was expected during deploy");
} catch (TransferFailedException expected) {
- assertTrue(true);
}
verify(transferListener);
}
- public void testPutTransferEvents()
- throws ConnectionException, AuthenticationException,
ResourceDoesNotExistException, TransferFailedException,
- AuthorizationException {
+ @Test
+ void putTransferEvents()
+ throws Exception {
transferListener.debug("deploy debug message");
transferListener.transferInitiated(anyObject(TransferEvent.class));
transferListener.transferStarted(anyObject(TransferEvent.class));
@@ -379,7 +390,8 @@ public void testPutTransferEvents()
verify(transferListener);
}
- public void testStreamShutdown() {
+ @Test
+ void streamShutdown() {
try (InputStreamMock inputStream = new InputStreamMock()) {
assertFalse(inputStream.isClosed());
}
@@ -389,7 +401,8 @@ public void testStreamShutdown() {
}
}
- public void testRepositoryPermissionsOverride() throws
ConnectionException, AuthenticationException {
+ @Test
+ void repositoryPermissionsOverride() throws Exception {
Repository repository = new Repository("fake", "http://fake");
RepositoryPermissions original = new RepositoryPermissions();
@@ -406,7 +419,8 @@ public void testRepositoryPermissionsOverride() throws
ConnectionException, Auth
assertEquals("644", repository.getPermissions().getFileMode());
}
- public void testRepositoryUserName() throws ConnectionException,
AuthenticationException {
+ @Test
+ void repositoryUserName() throws Exception {
Repository repository = new Repository("id",
"http://bporter:[email protected]/path/to/resource");
AuthenticationInfo authenticationInfo = new AuthenticationInfo();
@@ -419,7 +433,8 @@ public void testRepositoryUserName() throws
ConnectionException, AuthenticationE
assertEquals("pass", authenticationInfo.getPassword());
}
- public void testRepositoryUserNameNotGivenInCredentials() throws
ConnectionException, AuthenticationException {
+ @Test
+ void repositoryUserNameNotGivenInCredentials() throws Exception {
Repository repository = new Repository("id",
"http://bporter:[email protected]/path/to/resource");
AuthenticationInfo authenticationInfo = new AuthenticationInfo();
@@ -430,16 +445,17 @@ public void testRepositoryUserNameNotGivenInCredentials()
throws ConnectionExcep
assertEquals("password", authenticationInfo.getPassword());
}
- public void testConnectNullRepository() throws ConnectionException,
AuthenticationException {
+ @Test
+ void connectNullRepository() throws Exception {
try {
wagon.connect(null);
fail();
} catch (NullPointerException e) {
- assertTrue(true);
}
}
- public void testPostProcessListeners() throws TransferFailedException,
IOException {
+ @Test
+ void postProcessListeners() throws Exception {
File tempFile = File.createTempFile("wagon", "tmp");
tempFile.deleteOnExit();
String content = "content";
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/CannotConnectExceptionTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/CannotConnectExceptionTest.java
index 2f31141e..41da0601 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/CannotConnectExceptionTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/CannotConnectExceptionTest.java
@@ -18,14 +18,17 @@
*/
package org.apache.maven.wagon;
-import junit.framework.TestCase;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author <a href="mailto:[email protected]">Jason van Zyl</a>
*
*/
-public class CannotConnectExceptionTest extends TestCase {
- public void testCannotConnectExceptionTest() {
+class CannotConnectExceptionTest {
+ @Test
+ void cannotConnectExceptionTest() {
ConnectionException ae = new ConnectionException("message");
assertEquals("message", ae.getMessage());
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/LazyFileOutputStreamTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/LazyFileOutputStreamTest.java
index 21cc3b0d..91d97a69 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/LazyFileOutputStreamTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/LazyFileOutputStreamTest.java
@@ -21,20 +21,18 @@
import java.io.File;
import java.nio.file.Files;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author <a href="mailto:[email protected]">Michal Maczka</a>
*
*/
-public class LazyFileOutputStreamTest {
+class LazyFileOutputStreamTest {
@Test
- public void fileCreation() throws Exception {
+ void fileCreation() throws Exception {
File file = File.createTempFile("LazyFileOutputStreamTest", null);
file.delete();
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/NotAuthorizedExceptionTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/NotAuthorizedExceptionTest.java
index 99b17313..9308f982 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/NotAuthorizedExceptionTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/NotAuthorizedExceptionTest.java
@@ -18,15 +18,18 @@
*/
package org.apache.maven.wagon;
-import junit.framework.TestCase;
import org.apache.maven.wagon.authorization.AuthorizationException;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author <a href="mailto:[email protected]">Jason van Zyl</a>
*
*/
-public class NotAuthorizedExceptionTest extends TestCase {
- public void testNotAuthorizedExceptionTest() {
+class NotAuthorizedExceptionTest {
+ @Test
+ void notAuthorizedExceptionTest() {
AuthorizationException ae = new AuthorizationException("message");
assertEquals("message", ae.getMessage());
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/PathUtilsTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/PathUtilsTest.java
index c2556eed..5f83d924 100644
--- a/wagon-provider-api/src/test/java/org/apache/maven/wagon/PathUtilsTest.java
+++ b/wagon-provider-api/src/test/java/org/apache/maven/wagon/PathUtilsTest.java
@@ -20,14 +20,17 @@
import java.io.File;
-import junit.framework.TestCase;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author <a href="[email protected]">Michal Maczka</a>
*
*/
-public class PathUtilsTest extends TestCase {
- public void testFilenameResolving() {
+class PathUtilsTest {
+ @Test
+ void filenameResolving() {
assertEquals("filename", PathUtils.filename("dir/filename"));
assertEquals("filename", PathUtils.filename("filename"));
@@ -35,7 +38,8 @@ public void testFilenameResolving() {
assertEquals("filename", PathUtils.filename("dir1/dir2/filename"));
}
- public void testDirResolving() {
+ @Test
+ void dirResolving() {
assertEquals("dir", PathUtils.dirname("dir/filename"));
assertEquals("", PathUtils.dirname("filename"));
@@ -43,7 +47,8 @@ public void testDirResolving() {
assertEquals("dir1/dir2", PathUtils.dirname("dir1/dir2/filename"));
}
- public void testDirSpliting() {
+ @Test
+ void dirSpliting() {
final String path = "a/b/c";
final String[] dirs = PathUtils.dirnames(path);
@@ -57,7 +62,8 @@ public void testDirSpliting() {
assertEquals("b", dirs[1]);
}
- public void testHostResolving() {
+ @Test
+ void hostResolving() {
assertEquals("www.codehaus.org",
PathUtils.host("http://www.codehaus.org"));
assertEquals("www.codehaus.org",
PathUtils.host("HTTP://www.codehaus.org"));
@@ -66,7 +72,8 @@ public void testHostResolving() {
assertEquals("localhost", PathUtils.host("FILE:///c:/temp"));
}
- public void testScmHostResolving() {
+ @Test
+ void scmHostResolving() {
assertEquals("www.codehaus.org",
PathUtils.host("scm:svn:http://www.codehaus.org"));
assertEquals("www.codehaus.org",
PathUtils.host("SCM:SVN:HTTP://www.codehaus.org"));
assertEquals("www.codehaus.org",
PathUtils.host("scm:svn:http://www.codehaus.org/repos/module"));
@@ -75,7 +82,8 @@ public void testScmHostResolving() {
assertEquals("www.codehaus.org",
PathUtils.host("SCM:CVS:pserver:[email protected]:/root"));
}
- public void testProtocolResolving() {
+ @Test
+ void protocolResolving() {
assertEquals("http", PathUtils.protocol("http://www.codehause.org"));
assertEquals("HTTP", PathUtils.protocol("HTTP://www.codehause.org"));
assertEquals("file", PathUtils.protocol("file:///c:/temp"));
@@ -83,7 +91,8 @@ public void testProtocolResolving() {
assertEquals("scm",
PathUtils.protocol("scm:cvs:pserver:[email protected]:/home/cvspublic"));
}
- public void testUserInfo() {
+ @Test
+ void userInfo() {
String urlWithUsername = "http://[email protected]";
assertEquals("brett", PathUtils.user(urlWithUsername));
assertNull(PathUtils.password(urlWithUsername));
@@ -97,7 +106,8 @@ public void testUserInfo() {
assertEquals("/", PathUtils.basedir(urlWithUsernamePassword));
}
- public void testSubversionUserInfo() {
+ @Test
+ void subversionUserInfo() {
String urlWithUsername = "scm:svn:http://[email protected]";
assertEquals("brett", PathUtils.user(urlWithUsername));
assertNull(PathUtils.password(urlWithUsername));
@@ -117,7 +127,8 @@ public void testSubversionUserInfo() {
assertEquals("/", PathUtils.basedir(urlWithUpperCaseProtocol));
}
- public void testCvsUserInfo() {
+ @Test
+ void cvsUserInfo() {
String urlWithUsername = "scm:cvs:pserver:[email protected]";
assertEquals("brett", PathUtils.user(urlWithUsername));
assertNull(PathUtils.password(urlWithUsername));
@@ -137,7 +148,8 @@ public void testCvsUserInfo() {
assertEquals("/", PathUtils.basedir(urlWithUpperCaseProtocol));
}
- public void testFileBasedir() {
+ @Test
+ void fileBasedir() {
// see http://www.mozilla.org/quality/networking/testing/filetests.html
// strict forms
@@ -173,7 +185,8 @@ public void testFileBasedir() {
assertEquals("localhost", PathUtils.host("FILE:///c:/temp"));
}
- public void testEmptyBasedir() {
+ @Test
+ void emptyBasedir() {
assertEquals("/", PathUtils.basedir("http://www.codehaus.org:80"));
assertEquals("/", PathUtils.basedir("http://www.codehaus.org"));
assertEquals("/", PathUtils.basedir("http://www.codehaus.org:80/"));
@@ -181,7 +194,8 @@ public void testEmptyBasedir() {
assertEquals("/", PathUtils.basedir("HTTP://www.codehaus.org/"));
}
- public void testEmptyProtocol() {
+ @Test
+ void emptyProtocol() {
assertEquals("", PathUtils.protocol("placeholder-only"));
assertEquals("", PathUtils.protocol("placeholder-only/module-a"));
@@ -195,7 +209,8 @@ public void testEmptyProtocol() {
assertEquals("/module-a",
PathUtils.basedir("placeholder-only/module-a"));
}
- public void testPortResolving() {
+ @Test
+ void portResolving() {
assertEquals(80, PathUtils.port("http://www.codehause.org:80/maven"));
assertEquals(80, PathUtils.port("HTTP://www.codehause.org:80/maven"));
assertEquals(WagonConstants.UNKNOWN_PORT,
PathUtils.port("http://localhost/temp"));
@@ -204,7 +219,8 @@ public void testPortResolving() {
assertEquals(10, PathUtils.port("FTP://localhost:10"));
}
- public void testScmPortResolving() {
+ @Test
+ void scmPortResolving() {
assertEquals(80,
PathUtils.port("scm:svn:http://www.codehaus.org:80/maven"));
assertEquals(80,
PathUtils.port("SCM:SVN:HTTP://www.codehaus.org:80/maven"));
assertEquals(WagonConstants.UNKNOWN_PORT,
PathUtils.port("scm:cvs:pserver:anoncvs@localhost:/temp:module"));
@@ -213,7 +229,8 @@ public void testScmPortResolving() {
assertEquals(2402,
PathUtils.port("SCM:CVS:pserver:anoncvs@localhost:2402/temp:module"));
}
- public void testScmBasedir() {
+ @Test
+ void scmBasedir() {
assertEquals("/maven",
PathUtils.basedir("scm:svn:http://www.codehause.org/maven"));
assertEquals("/maven",
PathUtils.basedir("SCM:SVN:HTTP://www.codehause.org/maven"));
assertEquals("/maven",
PathUtils.basedir("scm:svn:http://www.codehause.org:80/maven"));
@@ -224,7 +241,8 @@ public void testScmBasedir() {
assertEquals("/maven/module",
PathUtils.basedir("SCM:CVS:pserver:[email protected]:/maven:module"));
}
- public void testPortBasedir() {
+ @Test
+ void portBasedir() {
assertEquals("/maven",
PathUtils.basedir("http://www.codehause.org:80/maven"));
assertEquals("/temp", PathUtils.basedir("http://localhost/temp"));
@@ -233,7 +251,8 @@ public void testPortBasedir() {
assertEquals("/", PathUtils.basedir("http://localhost/"));
}
- public void testIpV4() {
+ @Test
+ void ipV4() {
assertUrl("http://127.0.0.1", "http", null, null, "127.0.0.1", -1,
"/");
assertUrl("http://127.0.0.1:8080", "http", null, null, "127.0.0.1",
8080, "/");
assertUrl("http://127.0.0.1/oo/rest/users", "http", null, null,
"127.0.0.1", -1, "/oo/rest/users");
@@ -268,7 +287,8 @@ public void testIpV4() {
"/oo/rest/users");
}
- public void testIPv6() {
+ @Test
+ void iPv6() {
assertUrl(
"http://user:password@[fff:::1]:7891/oo/rest/users",
"http",
@@ -370,7 +390,8 @@ private void assertUrl(
assertEquals(basedir, PathUtils.basedir(url));
}
- public void testToRelative() {
+ @Test
+ void toRelative() {
assertEquals(
"dir",
PathUtils.toRelative(
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/PermissionModeUtilsTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/PermissionModeUtilsTest.java
index f5314d1a..df8401e4 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/PermissionModeUtilsTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/PermissionModeUtilsTest.java
@@ -18,7 +18,9 @@
*/
package org.apache.maven.wagon;
-import junit.framework.TestCase;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* Unit test for PermissionModeUtils class
@@ -27,11 +29,12 @@
* @see PermissionModeUtils
* @since Sep 3, 2005
*/
-public class PermissionModeUtilsTest extends TestCase {
+class PermissionModeUtilsTest {
/**
* @throws Exception on error
*/
- public void testNumeric() throws Exception {
+ @Test
+ void numeric() throws Exception {
final String[][] tests = {
{"0", "777"},
{"0000", "777"},
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/ResourceDoesNotExistExceptionTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/ResourceDoesNotExistExceptionTest.java
index ef33f1e1..c5f7d29e 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/ResourceDoesNotExistExceptionTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/ResourceDoesNotExistExceptionTest.java
@@ -18,14 +18,17 @@
*/
package org.apache.maven.wagon;
-import junit.framework.TestCase;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author <a href="mailto:[email protected]">Jason van Zyl</a>
*
*/
-public class ResourceDoesNotExistExceptionTest extends TestCase {
- public void testResourceDoesNotExistExceptionTest() {
+class ResourceDoesNotExistExceptionTest {
+ @Test
+ void resourceDoesNotExistExceptionTest() {
ResourceDoesNotExistException ae = new
ResourceDoesNotExistException("message");
assertEquals("message", ae.getMessage());
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/StreamWagonTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/StreamWagonTest.java
index 83583cae..c8448306 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/StreamWagonTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/StreamWagonTest.java
@@ -28,17 +28,18 @@
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
-import junit.framework.TestCase;
import org.apache.maven.wagon.authentication.AuthenticationException;
import org.apache.maven.wagon.authorization.AuthorizationException;
import org.apache.maven.wagon.events.TransferEvent;
import org.apache.maven.wagon.events.TransferListener;
import org.apache.maven.wagon.repository.Repository;
import org.apache.maven.wagon.resource.Resource;
+import org.junit.jupiter.api.Test;
import static org.easymock.EasyMock.*;
+import static org.junit.jupiter.api.Assertions.*;
-public class StreamWagonTest extends TestCase {
+class StreamWagonTest {
private static class TestWagon extends StreamWagon {
@Override
public void closeConnection() throws ConnectionException {}
@@ -56,7 +57,8 @@ protected void openConnectionInternal() throws
ConnectionException, Authenticati
private final Repository repository = new Repository("id", "url");
- public void testNullInputStream() throws Exception {
+ @Test
+ void nullInputStream() throws Exception {
StreamingWagon wagon = new TestWagon() {
@Override
public void fillInputData(InputData inputData) {
@@ -77,7 +79,6 @@ public void fillInputData(InputData inputData) {
wagon.getToStream("resource", os);
fail();
} catch (TransferFailedException e) {
- assertTrue(true);
} finally {
wagon.disconnect();
}
@@ -85,7 +86,8 @@ public void fillInputData(InputData inputData) {
verify(listener);
}
- public void testNullOutputStream() throws Exception {
+ @Test
+ void nullOutputStream() throws Exception {
StreamingWagon wagon = new TestWagon() {
@Override
public void fillOutputData(OutputData inputData) {
@@ -106,7 +108,6 @@ public void fillOutputData(OutputData inputData) {
wagon.putFromStream(is, "resource");
fail();
} catch (TransferFailedException e) {
- assertTrue(true);
} finally {
wagon.disconnect();
}
@@ -114,16 +115,17 @@ public void fillOutputData(OutputData inputData) {
verify(listener);
}
- public void testTransferFailedExceptionOnInput() throws Exception {
+ @Test
+ void transferFailedExceptionOnInput() throws Exception {
try {
runTestTransferError(new TransferFailedException(""));
fail();
} catch (TransferFailedException e) {
- assertTrue(true);
}
}
- public void testTransferFailedExceptionOnOutput() throws Exception {
+ @Test
+ void transferFailedExceptionOnOutput() throws Exception {
StreamingWagon wagon = new TestWagon() {
@Override
public void fillOutputData(OutputData inputData) throws
TransferFailedException {
@@ -145,28 +147,27 @@ public void fillOutputData(OutputData inputData) throws
TransferFailedException
wagon.putFromStream(is, "resource");
fail();
} catch (TransferFailedException e) {
- assertTrue(true);
} finally {
wagon.disconnect();
verify(listener);
}
}
- public void testResourceDoesNotExistException() throws Exception {
+ @Test
+ void resourceDoesNotExistException() throws Exception {
try {
runTestTransferError(new ResourceDoesNotExistException(""));
fail();
} catch (ResourceDoesNotExistException e) {
- assertTrue(true);
}
}
- public void testAuthorizationException() throws Exception {
+ @Test
+ void authorizationException() throws Exception {
try {
runTestTransferError(new AuthorizationException(""));
fail();
} catch (AuthorizationException e) {
- assertTrue(true);
}
}
@@ -207,21 +208,24 @@ public void fillInputData(InputData inputData)
}
}
- public void testGetIfNewerWithNewerResource() throws Exception {
+ @Test
+ void getIfNewerWithNewerResource() throws Exception {
long resourceTime = System.currentTimeMillis();
long comparisonTime =
new
SimpleDateFormat("yyyy-MM-dd").parse("2008-01-01").getTime();
assertTrue(runTestGetIfNewer(resourceTime, comparisonTime));
}
- public void testGetIfNewerWithOlderResource() throws Exception {
+ @Test
+ void getIfNewerWithOlderResource() throws Exception {
long comparisonTime = System.currentTimeMillis();
long resourceTime =
new
SimpleDateFormat("yyyy-MM-dd").parse("2008-01-01").getTime();
assertFalse(runTestGetIfNewer(resourceTime, comparisonTime));
}
- public void testGetIfNewerWithSameTimeResource() throws Exception {
+ @Test
+ void getIfNewerWithSameTimeResource() throws Exception {
long resourceTime =
new
SimpleDateFormat("yyyy-MM-dd").parse("2008-01-01").getTime();
assertFalse(runTestGetIfNewer(resourceTime, resourceTime));
@@ -250,7 +254,8 @@ public void fillInputData(InputData inputData) {
}
}
- public void testGetToStream() throws Exception {
+ @Test
+ void getToStream() throws Exception {
final String content = "the content to return";
final long comparisonTime =
new
SimpleDateFormat("yyyy-MM-dd").parse("2008-01-01").getTime();
@@ -272,7 +277,8 @@ public void fillInputData(InputData inputData) {
}
}
- public void testGet() throws Exception {
+ @Test
+ void get() throws Exception {
final String content = "the content to return";
final long comparisonTime =
new
SimpleDateFormat("yyyy-MM-dd").parse("2008-01-01").getTime();
@@ -297,21 +303,24 @@ public void fillInputData(InputData inputData) {
}
}
- public void testGetIfNewerToStreamWithNewerResource() throws Exception {
+ @Test
+ void getIfNewerToStreamWithNewerResource() throws Exception {
long resourceTime = System.currentTimeMillis();
long comparisonTime =
new
SimpleDateFormat("yyyy-MM-dd").parse("2008-01-01").getTime();
assertTrue(runTestGetIfNewerToStream(resourceTime, comparisonTime));
}
- public void testGetIfNewerToStreamWithOlderResource() throws Exception {
+ @Test
+ void getIfNewerToStreamWithOlderResource() throws Exception {
long comparisonTime = System.currentTimeMillis();
long resourceTime =
new
SimpleDateFormat("yyyy-MM-dd").parse("2008-01-01").getTime();
assertFalse(runTestGetIfNewerToStream(resourceTime, comparisonTime));
}
- public void testGetIfNewerToStreamWithSameTimeResource() throws Exception {
+ @Test
+ void getIfNewerToStreamWithSameTimeResource() throws Exception {
long resourceTime =
new
SimpleDateFormat("yyyy-MM-dd").parse("2008-01-01").getTime();
assertFalse(runTestGetIfNewerToStream(resourceTime, resourceTime));
@@ -336,7 +345,8 @@ public void fillInputData(InputData inputData) {
}
}
- public void testPutFromStream() throws Exception {
+ @Test
+ void putFromStream() throws Exception {
final String content = "the content to return";
OutputStream out = new ByteArrayOutputStream();
@@ -359,7 +369,8 @@ public void fillOutputData(OutputData outputData) {
}
}
- public void testPutFromStreamWithResourceInformation() throws Exception {
+ @Test
+ void putFromStreamWithResourceInformation() throws Exception {
final String content = "the content to return";
final long lastModified = System.currentTimeMillis();
@@ -384,7 +395,8 @@ public void fillOutputData(OutputData outputData) {
}
}
- public void testPut() throws Exception {
+ @Test
+ void put() throws Exception {
final String content = "the content to return";
final File tempFile = File.createTempFile("wagon", "tmp");
@@ -412,7 +424,8 @@ public void fillOutputData(OutputData outputData) {
}
}
- public void testPutFileDoesntExist() throws Exception {
+ @Test
+ void putFileDoesntExist() throws Exception {
final File tempFile = File.createTempFile("wagon", "tmp");
tempFile.delete();
assertFalse(tempFile.exists());
@@ -424,7 +437,6 @@ public void testPutFileDoesntExist() throws Exception {
wagon.put(tempFile, "resource");
fail();
} catch (TransferFailedException e) {
- assertTrue(true);
} finally {
wagon.disconnect();
}
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/TransferFailedExceptionTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/TransferFailedExceptionTest.java
index b3b3d5d0..85fe0ddd 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/TransferFailedExceptionTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/TransferFailedExceptionTest.java
@@ -18,14 +18,17 @@
*/
package org.apache.maven.wagon;
-import junit.framework.TestCase;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author <a href="mailto:[email protected]">Jason van Zyl</a>
*
*/
-public class TransferFailedExceptionTest extends TestCase {
- public void testTransferFailedExceptionTest() {
+class TransferFailedExceptionTest {
+ @Test
+ void transferFailedExceptionTest() {
TransferFailedException ae = new TransferFailedException("message");
assertEquals("message", ae.getMessage());
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication/AuthenticationExceptionTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication/AuthenticationExceptionTest.java
index 02defbd9..aa7cd6c5 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication/AuthenticationExceptionTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication/AuthenticationExceptionTest.java
@@ -18,33 +18,17 @@
*/
package org.apache.maven.wagon.authentication;
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
+import org.junit.jupiter.api.Test;
-import junit.framework.TestCase;
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author <a href="mailto:[email protected]">Jason van Zyl</a>
*
*/
-public class AuthenticationExceptionTest extends TestCase {
- public void testAuthenticationExceptionTest() {
+class AuthenticationExceptionTest {
+ @Test
+ void authenticationExceptionTest() {
AuthenticationException ae = new AuthenticationException("message");
assertEquals("message", ae.getMessage());
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication/AuthenticationInfoTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication/AuthenticationInfoTest.java
index ff7765b2..1e5ba7ae 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication/AuthenticationInfoTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/authentication/AuthenticationInfoTest.java
@@ -18,27 +18,31 @@
*/
package org.apache.maven.wagon.authentication;
-import junit.framework.TestCase;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author <a href="mailto:[email protected]">Jason van Zyl</a>
*
* @todo test defaults
*/
-public class AuthenticationInfoTest extends TestCase {
+public class AuthenticationInfoTest {
public AuthenticationInfoTest(final String name) {
- super(name);
}
- public void setUp() throws Exception {
- super.setUp();
+ @BeforeEach
+ void setUp() throws Exception {
}
- public void tearDown() throws Exception {
- super.tearDown();
+ @AfterEach
+ void tearDown() throws Exception {
}
- public void testAuthenticationInfoProperties() {
+ @Test
+ void authenticationInfoProperties() {
final AuthenticationInfo authenticationInfo = new AuthenticationInfo();
authenticationInfo.setUserName("username");
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java
index f554a466..992e2499 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventSupportTest.java
@@ -18,26 +18,29 @@
*/
package org.apache.maven.wagon.events;
-import junit.framework.TestCase;
import org.apache.maven.wagon.Wagon;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.easymock.EasyMock.*;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author <a href="[email protected]">Michal Maczka</a>
*
*/
-public class SessionEventSupportTest extends TestCase {
+class SessionEventSupportTest {
private SessionEventSupport eventSupport;
private Wagon wagon;
/**
- * @see junit.framework.TestCase#setUp()
+ * @see
*/
- protected void setUp() throws Exception {
- super.setUp();
+ @BeforeEach
+ void setUp() throws Exception {
eventSupport = new SessionEventSupport();
@@ -45,7 +48,8 @@ protected void setUp() throws Exception {
wagon = createNiceMock(Wagon.class);
}
- public void testSessionListenerRegistration() {
+ @Test
+ void sessionListenerRegistration() {
SessionListener mock1 = createMock(SessionListener.class);
eventSupport.addSessionListener(mock1);
@@ -73,7 +77,8 @@ public void testSessionListenerRegistration() {
assertFalse(eventSupport.hasSessionListener(mock1));
}
- public void testFireSessionDisconnected() {
+ @Test
+ void fireSessionDisconnected() {
SessionListener mock1 = createMock(SessionListener.class);
eventSupport.addSessionListener(mock1);
@@ -94,7 +99,8 @@ public void testFireSessionDisconnected() {
verify(mock1, mock2);
}
- public void testFireSessionDisconneting() {
+ @Test
+ void fireSessionDisconneting() {
SessionListener mock1 = createMock(SessionListener.class);
eventSupport.addSessionListener(mock1);
@@ -115,7 +121,8 @@ public void testFireSessionDisconneting() {
verify(mock1, mock2);
}
- public void testFireSessionLoggedIn() {
+ @Test
+ void fireSessionLoggedIn() {
SessionListener mock1 = createMock(SessionListener.class);
eventSupport.addSessionListener(mock1);
@@ -136,7 +143,8 @@ public void testFireSessionLoggedIn() {
verify(mock1, mock2);
}
- public void testFireSessionLoggedOff() {
+ @Test
+ void fireSessionLoggedOff() {
SessionListener mock1 = createMock(SessionListener.class);
eventSupport.addSessionListener(mock1);
@@ -157,7 +165,8 @@ public void testFireSessionLoggedOff() {
verify(mock1, mock2);
}
- public void testFireSessionOpened() {
+ @Test
+ void fireSessionOpened() {
SessionListener mock1 = createMock(SessionListener.class);
eventSupport.addSessionListener(mock1);
@@ -178,7 +187,8 @@ public void testFireSessionOpened() {
verify(mock1, mock2);
}
- public void testFireSessionOpenning() {
+ @Test
+ void fireSessionOpenning() {
SessionListener mock1 = createMock(SessionListener.class);
eventSupport.addSessionListener(mock1);
@@ -199,7 +209,8 @@ public void testFireSessionOpenning() {
verify(mock1, mock2);
}
- public void testFireSessionRefused() {
+ @Test
+ void fireSessionRefused() {
SessionListener mock1 = createMock(SessionListener.class);
eventSupport.addSessionListener(mock1);
@@ -220,7 +231,8 @@ public void testFireSessionRefused() {
verify(mock1, mock2);
}
- public void testFireDebug() {
+ @Test
+ void fireDebug() {
SessionListener mock1 = createMock(SessionListener.class);
eventSupport.addSessionListener(mock1);
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventTest.java
index d28cdf71..3012c923 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/SessionEventTest.java
@@ -18,23 +18,25 @@
*/
package org.apache.maven.wagon.events;
-import junit.framework.TestCase;
-import org.apache.maven.wagon.ConnectionException;
import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.authentication.AuthenticationException;
import org.apache.maven.wagon.repository.Repository;
import org.easymock.EasyMock;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author <a href="[email protected]">Michal Maczka</a>
*
*/
-public class SessionEventTest extends TestCase {
+class SessionEventTest {
/*
* Class to test for void SESSIONEvent(Wagon, Repository, String, int,
* int)
*/
- public void testSessionEventProperties() throws ConnectionException,
AuthenticationException {
+ @Test
+ void sessionEventProperties() throws Exception {
final Wagon wagon = EasyMock.createMock(Wagon.class);
final Repository repo = new Repository("fake", "http://fake");
@@ -57,7 +59,7 @@ public void testSessionEventProperties() throws
ConnectionException, Authenticat
assertEquals(exception, event.getException());
event.setException(null);
- assertEquals(null, event.getException());
+ assertNull(event.getException());
event.setException(exception);
assertEquals(exception, event.getException());
@@ -96,11 +98,11 @@ public void testSessionEventProperties() throws
ConnectionException, Authenticat
event.setEventType(-1);
fail("Exception expected");
} catch (IllegalArgumentException e) {
- assertTrue(true);
}
}
- public void testConstantValueConflict() {
+ @Test
+ void constantValueConflict() {
final int[] values = {
SessionEvent.SESSION_CLOSED, SessionEvent.SESSION_DISCONNECTED,
SessionEvent.SESSION_DISCONNECTING,
SessionEvent.SESSION_ERROR_OCCURRED,
@@ -113,7 +115,7 @@ public void testConstantValueConflict() {
for (int j = i + 1; j < values.length; j++) {
final String msg = "Value confict at [i,j]=[" + i + "," + j +
"]";
- assertTrue(msg, values[i] != values[j]);
+ assertNotSame(values[i], values[j], msg);
}
}
}
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java
index 147aadf7..5e54fa05 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventSupportTest.java
@@ -18,26 +18,29 @@
*/
package org.apache.maven.wagon.events;
-import junit.framework.TestCase;
import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.resource.Resource;
import org.easymock.EasyMock;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import static org.easymock.EasyMock.*;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author <a href="[email protected]">Michal Maczka</a>
*/
-public class TransferEventSupportTest extends TestCase {
+class TransferEventSupportTest {
private TransferEventSupport eventSupport;
private Wagon wagon;
/**
- * @see junit.framework.TestCase#setUp()
+ * @see
*/
- protected void setUp() throws Exception {
- super.setUp();
+ @BeforeEach
+ void setUp() throws Exception {
eventSupport = new TransferEventSupport();
@@ -45,7 +48,8 @@ protected void setUp() throws Exception {
wagon = EasyMock.createNiceMock(Wagon.class);
}
- public void testTransferListenerRegistration() {
+ @Test
+ void transferListenerRegistration() {
TransferListener mock1 = createMock(TransferListener.class);
eventSupport.addTransferListener(mock1);
@@ -68,7 +72,8 @@ public void testTransferListenerRegistration() {
assertFalse(eventSupport.hasTransferListener(mock1));
}
- public void testFireTransferStarted() {
+ @Test
+ void fireTransferStarted() {
TransferListener mock1 = createMock(TransferListener.class);
eventSupport.addTransferListener(mock1);
@@ -87,7 +92,8 @@ public void testFireTransferStarted() {
verify(mock1, mock2);
}
- public void testFireTransferProgress() {
+ @Test
+ void fireTransferProgress() {
TransferListener mock1 = createMock(TransferListener.class);
eventSupport.addTransferListener(mock1);
@@ -109,7 +115,8 @@ public void testFireTransferProgress() {
verify(mock1, mock2);
}
- public void testFireTransferCompleted() {
+ @Test
+ void fireTransferCompleted() {
TransferListener mock1 = createMock(TransferListener.class);
eventSupport.addTransferListener(mock1);
@@ -130,7 +137,8 @@ public void testFireTransferCompleted() {
verify(mock1, mock2);
}
- public void testFireTransferError() {
+ @Test
+ void fireTransferError() {
TransferListener mock1 = createMock(TransferListener.class);
eventSupport.addTransferListener(mock1);
@@ -151,7 +159,8 @@ public void testFireTransferError() {
verify(mock1, mock2);
}
- public void testFireDebug() {
+ @Test
+ void fireDebug() {
TransferListener mock1 = createMock(TransferListener.class);
eventSupport.addTransferListener(mock1);
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventTest.java
index c4c1212d..4864e4fc 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/events/TransferEventTest.java
@@ -18,24 +18,26 @@
*/
package org.apache.maven.wagon.events;
-import junit.framework.TestCase;
-import org.apache.maven.wagon.ConnectionException;
import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.authentication.AuthenticationException;
import org.apache.maven.wagon.repository.Repository;
import org.apache.maven.wagon.resource.Resource;
import org.easymock.EasyMock;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.*;
/**
* @author <a href="[email protected]">Michal Maczka</a>
*
*/
-public class TransferEventTest extends TestCase {
+class TransferEventTest {
/*
* Class to test for void TransferEvent(Wagon, Repository, String, int,
* int)
*/
- public void testTransferEventProperties() throws ConnectionException,
AuthenticationException {
+ @Test
+ void transferEventProperties() throws Exception {
final Wagon wagon = EasyMock.createMock(Wagon.class);
final Repository repo = new Repository("fake", "http://fake");
@@ -79,7 +81,7 @@ public void testTransferEventProperties() throws
ConnectionException, Authentica
event.setResource(null);
- assertEquals(null, event.getResource());
+ assertNull(event.getResource());
res.setName("/foo/baa");
@@ -104,7 +106,6 @@ public void testTransferEventProperties() throws
ConnectionException, Authentica
fail("Exception expected");
} catch (IllegalArgumentException e) {
- assertTrue(true);
}
event.setEventType(TransferEvent.TRANSFER_COMPLETED);
@@ -128,11 +129,11 @@ public void testTransferEventProperties() throws
ConnectionException, Authentica
fail("Exception expected");
} catch (IllegalArgumentException e) {
- assertTrue(true);
}
}
- public void testConstantValueConflict() {
+ @Test
+ void constantValueConflict() {
final int[] values = {
TransferEvent.TRANSFER_COMPLETED, TransferEvent.TRANSFER_ERROR,
TransferEvent.TRANSFER_STARTED, TransferEvent.TRANSFER_PROGRESS,
@@ -144,7 +145,7 @@ public void testConstantValueConflict() {
final String msg = "Value confict at [i,j]=[" + i + "," + j +
"]";
- assertTrue(msg, values[i] != values[j]);
+ assertNotSame(values[i], values[j], msg);
}
}
}
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/observers/ChecksumObserverTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/observers/ChecksumObserverTest.java
index 68f73ef4..d4436575 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/observers/ChecksumObserverTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/observers/ChecksumObserverTest.java
@@ -19,25 +19,26 @@
package org.apache.maven.wagon.observers;
import java.io.File;
-import java.io.IOException;
-import java.security.NoSuchAlgorithmException;
-import junit.framework.TestCase;
-import org.apache.maven.wagon.ResourceDoesNotExistException;
import org.apache.maven.wagon.TransferFailedException;
import org.apache.maven.wagon.Wagon;
import org.apache.maven.wagon.WagonMock;
-import org.apache.maven.wagon.authorization.AuthorizationException;
import org.apache.maven.wagon.events.TransferEvent;
import org.apache.maven.wagon.events.TransferListener;
import org.apache.maven.wagon.repository.Repository;
import org.apache.maven.wagon.resource.Resource;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-public class ChecksumObserverTest extends TestCase {
+import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+class ChecksumObserverTest {
private Wagon wagon;
- public void setUp() throws Exception {
- super.setUp();
+ @BeforeEach
+ void setUp() throws Exception {
wagon = new WagonMock(true);
@@ -45,14 +46,14 @@ public void setUp() throws Exception {
wagon.connect(repository);
}
- public void tearDown() throws Exception {
+ @AfterEach
+ void tearDown() throws Exception {
wagon.disconnect();
-
- super.tearDown();
}
- public void testSubsequentTransfersAfterTransferError()
- throws NoSuchAlgorithmException, ResourceDoesNotExistException,
AuthorizationException, IOException {
+ @Test
+ void subsequentTransfersAfterTransferError()
+ throws Exception {
TransferListener listener = new ChecksumObserver();
wagon.addTransferListener(listener);
@@ -64,20 +65,19 @@ public void testSubsequentTransfersAfterTransferError()
wagon.get("resource", testFile);
fail();
} catch (TransferFailedException e) {
- assertTrue(true);
}
try {
wagon.get("resource", testFile);
fail();
} catch (TransferFailedException e) {
- assertTrue(true);
}
testFile.delete();
}
- public void testChecksum() throws NoSuchAlgorithmException {
+ @Test
+ void checksum() throws Exception {
ChecksumObserver listener = new ChecksumObserver("SHA-1");
Resource resource = new Resource("resource");
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/proxy/ProxyInfoTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/proxy/ProxyInfoTest.java
index 4ea306d1..3ace2866 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/proxy/ProxyInfoTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/proxy/ProxyInfoTest.java
@@ -18,26 +18,30 @@
*/
package org.apache.maven.wagon.proxy;
-import junit.framework.TestCase;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author <a href="mailto:[email protected]">Jason van Zyl</a>
*
*/
-public class ProxyInfoTest extends TestCase {
+public class ProxyInfoTest {
public ProxyInfoTest(final String name) {
- super(name);
}
- public void setUp() throws Exception {
- super.setUp();
+ @BeforeEach
+ void setUp() throws Exception {
}
- public void tearDown() throws Exception {
- super.tearDown();
+ @AfterEach
+ void tearDown() throws Exception {
}
- public void testProxyInfoProperties() {
+ @Test
+ void proxyInfoProperties() {
final ProxyInfo proxyInfo = new ProxyInfo();
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/proxy/ProxyInfoUtilsTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/proxy/ProxyInfoUtilsTest.java
index 717f22eb..0f3631a9 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/proxy/ProxyInfoUtilsTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/proxy/ProxyInfoUtilsTest.java
@@ -18,29 +18,35 @@
*/
package org.apache.maven.wagon.proxy;
-import junit.framework.TestCase;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author <a href="mailto:[email protected]">Thomas Champagne</a>
*/
-public class ProxyInfoUtilsTest extends TestCase {
+public class ProxyInfoUtilsTest {
public ProxyInfoUtilsTest(final String name) {
- super(name);
}
- public void setUp() throws Exception {
- super.setUp();
+ @BeforeEach
+ void setUp() throws Exception {
}
- public void tearDown() throws Exception {
- super.tearDown();
+ @AfterEach
+ void tearDown() throws Exception {
}
- public void testValidateNonProxyHostsWithNullProxy() {
- assertFalse("www.ibiblio.org", ProxyUtils.validateNonProxyHosts(null,
"maven.apache.org"));
+ @Test
+ void validateNonProxyHostsWithNullProxy() {
+ assertFalse(ProxyUtils.validateNonProxyHosts(null,
"maven.apache.org"), "www.ibiblio.org");
}
- public void testValidateNonProxyHostsWithUniqueHost() {
+ @Test
+ void validateNonProxyHostsWithUniqueHost() {
final ProxyInfo proxyInfo = new ProxyInfo();
proxyInfo.setUserName("username");
@@ -50,20 +56,21 @@ public void testValidateNonProxyHostsWithUniqueHost() {
proxyInfo.setType("SOCKSv4");
proxyInfo.setNonProxyHosts("*.apache.org");
- assertTrue("maven.apache.org",
ProxyUtils.validateNonProxyHosts(proxyInfo, "maven.apache.org"));
+ assertTrue(ProxyUtils.validateNonProxyHosts(proxyInfo,
"maven.apache.org"), "maven.apache.org");
- assertFalse("www.ibiblio.org",
ProxyUtils.validateNonProxyHosts(proxyInfo, "www.ibiblio.org"));
+ assertFalse(ProxyUtils.validateNonProxyHosts(proxyInfo,
"www.ibiblio.org"), "www.ibiblio.org");
- assertFalse("null", ProxyUtils.validateNonProxyHosts(proxyInfo, null));
+ assertFalse(ProxyUtils.validateNonProxyHosts(proxyInfo, null), "null");
proxyInfo.setNonProxyHosts(null);
- assertFalse("NonProxyHosts = null",
ProxyUtils.validateNonProxyHosts(proxyInfo, "maven.apache.org"));
+ assertFalse(ProxyUtils.validateNonProxyHosts(proxyInfo,
"maven.apache.org"), "NonProxyHosts = null");
proxyInfo.setNonProxyHosts("");
- assertFalse("NonProxyHosts = \"\"",
ProxyUtils.validateNonProxyHosts(proxyInfo, "maven.apache.org"));
+ assertFalse(ProxyUtils.validateNonProxyHosts(proxyInfo,
"maven.apache.org"), "NonProxyHosts = \"\"");
}
- public void testValidateNonProxyHostsWithMultipleHost() {
+ @Test
+ void validateNonProxyHostsWithMultipleHost() {
final ProxyInfo proxyInfo = new ProxyInfo();
proxyInfo.setUserName("username");
@@ -73,9 +80,9 @@ public void testValidateNonProxyHostsWithMultipleHost() {
proxyInfo.setType("SOCKSv4");
proxyInfo.setNonProxyHosts("*.apache.org|*.codehaus.org");
- assertTrue("maven.apache.org",
ProxyUtils.validateNonProxyHosts(proxyInfo, "maven.apache.org"));
- assertTrue("wiki.codehaus.org",
ProxyUtils.validateNonProxyHosts(proxyInfo, "wiki.codehaus.org"));
+ assertTrue(ProxyUtils.validateNonProxyHosts(proxyInfo,
"maven.apache.org"), "maven.apache.org");
+ assertTrue(ProxyUtils.validateNonProxyHosts(proxyInfo,
"wiki.codehaus.org"), "wiki.codehaus.org");
- assertFalse("www.ibiblio.org",
ProxyUtils.validateNonProxyHosts(proxyInfo, "www.ibiblio.org"));
+ assertFalse(ProxyUtils.validateNonProxyHosts(proxyInfo,
"www.ibiblio.org"), "www.ibiblio.org");
}
}
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/repository/RepositoryPermissionsTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/repository/RepositoryPermissionsTest.java
index b6356366..7c4522e7 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/repository/RepositoryPermissionsTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/repository/RepositoryPermissionsTest.java
@@ -18,27 +18,31 @@
*/
package org.apache.maven.wagon.repository;
-import junit.framework.TestCase;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author <a href="mailto:[email protected]">Brett Porter</a>
*
* @todo test defaults
*/
-public class RepositoryPermissionsTest extends TestCase {
+public class RepositoryPermissionsTest {
public RepositoryPermissionsTest(final String name) {
- super(name);
}
- public void setUp() throws Exception {
- super.setUp();
+ @BeforeEach
+ void setUp() throws Exception {
}
- public void tearDown() throws Exception {
- super.tearDown();
+ @AfterEach
+ void tearDown() throws Exception {
}
- public void testAuthenticationInfoProperties() {
+ @Test
+ void authenticationInfoProperties() {
final RepositoryPermissions repositoryPermissions = new
RepositoryPermissions();
repositoryPermissions.setDirectoryMode("directoryMode");
diff --git
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/repository/RepositoryTest.java
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/repository/RepositoryTest.java
index 5a1fc399..9580e956 100644
---
a/wagon-provider-api/src/test/java/org/apache/maven/wagon/repository/RepositoryTest.java
+++
b/wagon-provider-api/src/test/java/org/apache/maven/wagon/repository/RepositoryTest.java
@@ -18,19 +18,21 @@
*/
package org.apache.maven.wagon.repository;
-import junit.framework.TestCase;
import org.apache.maven.wagon.WagonConstants;
+import org.junit.jupiter.api.Test;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
/**
* @author <a href="mailto:[email protected]">Jason van Zyl</a>
*
*/
-public class RepositoryTest extends TestCase {
+public class RepositoryTest {
public RepositoryTest(final String name) {
- super(name);
}
- public void testRepositoryProperties() {
+ @Test
+ void repositoryProperties() {
Repository repository = new Repository("fake", "http://fake");
repository.setBasedir("directory");
@@ -86,7 +88,8 @@ public void testRepositoryProperties() {
assertEquals("http://www.ibiblio.org", repository.getUrl());
}
- public void testIPv6() {
+ @Test
+ void iPv6() {
assertRepository(
"http://user:password@[fff:::1]:7891/oo/rest/users",
"http://[fff:::1]:7891/oo/rest/users",