From f23c33822c0b3d10a16624ef2459d02a8ed01a6e Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 29 Apr 2020 17:52:43 +0200 Subject: [PATCH] Rename testmethods to make these more clear (#10231) Motivation: The currently used method names don't make a lot of sense. Modifications: Rename to cleanup Result: Cleanup --- .../handler/ssl/JdkSslClientContextTest.java | 2 +- .../handler/ssl/JdkSslServerContextTest.java | 2 +- .../handler/ssl/OpenSslClientContextTest.java | 2 +- .../handler/ssl/OpenSslServerContextTest.java | 2 +- .../io/netty/handler/ssl/SslContextTest.java | 22 +++++++++---------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/handler/src/test/java/io/netty/handler/ssl/JdkSslClientContextTest.java b/handler/src/test/java/io/netty/handler/ssl/JdkSslClientContextTest.java index 0da513e456..6f072a9ffa 100644 --- a/handler/src/test/java/io/netty/handler/ssl/JdkSslClientContextTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/JdkSslClientContextTest.java @@ -20,7 +20,7 @@ import java.io.File; public class JdkSslClientContextTest extends SslContextTest { @Override - protected SslContext newServerContext(File crtFile, File keyFile, String pass) throws SSLException { + protected SslContext newSslContext(File crtFile, File keyFile, String pass) throws SSLException { return SslContextBuilder.forClient() .sslProvider(SslProvider.JDK) .keyManager(crtFile, keyFile, pass) diff --git a/handler/src/test/java/io/netty/handler/ssl/JdkSslServerContextTest.java b/handler/src/test/java/io/netty/handler/ssl/JdkSslServerContextTest.java index f01b07ddbd..194dc16450 100644 --- a/handler/src/test/java/io/netty/handler/ssl/JdkSslServerContextTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/JdkSslServerContextTest.java @@ -21,7 +21,7 @@ import java.io.File; public class JdkSslServerContextTest extends SslContextTest { @Override - protected SslContext newServerContext(File crtFile, File keyFile, String pass) throws SSLException { + protected SslContext newSslContext(File crtFile, File keyFile, String pass) throws SSLException { return SslContextBuilder.forServer(crtFile, keyFile, pass).sslProvider(SslProvider.JDK).build(); } } diff --git a/handler/src/test/java/io/netty/handler/ssl/OpenSslClientContextTest.java b/handler/src/test/java/io/netty/handler/ssl/OpenSslClientContextTest.java index b1cc756863..2e4d2b70b1 100644 --- a/handler/src/test/java/io/netty/handler/ssl/OpenSslClientContextTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/OpenSslClientContextTest.java @@ -31,7 +31,7 @@ public class OpenSslClientContextTest extends SslContextTest { } @Override - protected SslContext newServerContext(File crtFile, File keyFile, String pass) throws SSLException { + protected SslContext newSslContext(File crtFile, File keyFile, String pass) throws SSLException { return SslContextBuilder.forClient() .sslProvider(SslProvider.OPENSSL) .trustManager(InsecureTrustManagerFactory.INSTANCE) diff --git a/handler/src/test/java/io/netty/handler/ssl/OpenSslServerContextTest.java b/handler/src/test/java/io/netty/handler/ssl/OpenSslServerContextTest.java index 058d35177f..e39a2934b6 100644 --- a/handler/src/test/java/io/netty/handler/ssl/OpenSslServerContextTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/OpenSslServerContextTest.java @@ -32,7 +32,7 @@ public class OpenSslServerContextTest extends SslContextTest { } @Override - protected SslContext newServerContext(File crtFile, File keyFile, String pass) throws SSLException { + protected SslContext newSslContext(File crtFile, File keyFile, String pass) throws SSLException { Assume.assumeTrue(OpenSsl.isAvailable()); return SslContextBuilder.forServer(crtFile, keyFile, pass).sslProvider(SslProvider.OPENSSL).build(); } diff --git a/handler/src/test/java/io/netty/handler/ssl/SslContextTest.java b/handler/src/test/java/io/netty/handler/ssl/SslContextTest.java index 125ce44c48..fa9cba7ec6 100644 --- a/handler/src/test/java/io/netty/handler/ssl/SslContextTest.java +++ b/handler/src/test/java/io/netty/handler/ssl/SslContextTest.java @@ -64,35 +64,35 @@ public abstract class SslContextTest { } @Test - public void testSslServerWithEncryptedPrivateKey() throws SSLException { + public void testSslContextWithEncryptedPrivateKey() throws SSLException { File keyFile = ResourcesUtil.getFile(getClass(), "test_encrypted.pem"); File crtFile = ResourcesUtil.getFile(getClass(), "test.crt"); - newServerContext(crtFile, keyFile, "12345"); + newSslContext(crtFile, keyFile, "12345"); } @Test - public void testSslServerWithEncryptedPrivateKey2() throws SSLException { + public void testSslContextWithEncryptedPrivateKey2() throws SSLException { File keyFile = ResourcesUtil.getFile(getClass(), "test2_encrypted.pem"); File crtFile = ResourcesUtil.getFile(getClass(), "test2.crt"); - newServerContext(crtFile, keyFile, "12345"); + newSslContext(crtFile, keyFile, "12345"); } @Test - public void testSslServerWithUnencryptedPrivateKey() throws SSLException { + public void testSslContextWithUnencryptedPrivateKey() throws SSLException { File keyFile = ResourcesUtil.getFile(getClass(), "test_unencrypted.pem"); File crtFile = ResourcesUtil.getFile(getClass(), "test.crt"); - newServerContext(crtFile, keyFile, null); + newSslContext(crtFile, keyFile, null); } @Test(expected = IllegalArgumentException.class) - public void testSslServerWithUnencryptedPrivateKeyEmptyPass() throws SSLException { + public void testSslContextWithUnencryptedPrivateKeyEmptyPass() throws SSLException { File keyFile = ResourcesUtil.getFile(getClass(), "test_unencrypted.pem"); File crtFile = ResourcesUtil.getFile(getClass(), "test.crt"); - newServerContext(crtFile, keyFile, ""); + newSslContext(crtFile, keyFile, ""); } @Test @@ -112,14 +112,14 @@ public abstract class SslContextTest { File keyFile = ResourcesUtil.getFile(getClass(), "test_unencrypted.pem"); File crtFile = ResourcesUtil.getFile(getClass(), "test.crt"); - SslContext sslContext = newServerContext(crtFile, keyFile, null); + SslContext sslContext = newSslContext(crtFile, keyFile, null); assertFalse(sslContext.cipherSuites().contains(unsupportedCipher)); } @Test(expected = CertificateException.class) - public void test() throws CertificateException { + public void testUnsupportedParams() throws CertificateException { SslContext.toX509Certificates(new File(getClass().getResource("ec_params_unsupported.pem").getFile())); } - protected abstract SslContext newServerContext(File crtFile, File keyFile, String pass) throws SSLException; + protected abstract SslContext newSslContext(File crtFile, File keyFile, String pass) throws SSLException; }