From f25d73d11267b8ccd76328e27bdf1f2025cd1a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thi=C3=A9baud=20Weksteen?= Date: Mon, 28 Oct 2024 19:28:01 +1100 Subject: [PATCH 1/2] Move NativeRefTest to JUnit4 (#1247) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ThiƩbaud Weksteen --- openjdk/src/test/java/org/conscrypt/NativeRefTest.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/openjdk/src/test/java/org/conscrypt/NativeRefTest.java b/openjdk/src/test/java/org/conscrypt/NativeRefTest.java index e13297b35..7b71dcdbf 100644 --- a/openjdk/src/test/java/org/conscrypt/NativeRefTest.java +++ b/openjdk/src/test/java/org/conscrypt/NativeRefTest.java @@ -16,9 +16,15 @@ package org.conscrypt; -import junit.framework.TestCase; +import static org.junit.Assert.fail; -public class NativeRefTest extends TestCase { +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +@RunWith(JUnit4.class) +public class NativeRefTest { + @Test public void test_zeroContextThrowsNullPointException() { try { new NativeRef(0) { From d286b36ff76e39485f900d5ea5ec5c91cfb93a13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thi=C3=A9baud=20Weksteen?= Date: Mon, 28 Oct 2024 19:30:18 +1100 Subject: [PATCH 2/2] Move OpenSSLKeyTest to JUnit4 (#1248) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: ThiƩbaud Weksteen --- .../src/test/java/org/conscrypt/OpenSSLKeyTest.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/openjdk/src/test/java/org/conscrypt/OpenSSLKeyTest.java b/openjdk/src/test/java/org/conscrypt/OpenSSLKeyTest.java index 4d9db076b..0935c4994 100644 --- a/openjdk/src/test/java/org/conscrypt/OpenSSLKeyTest.java +++ b/openjdk/src/test/java/org/conscrypt/OpenSSLKeyTest.java @@ -16,13 +16,18 @@ package org.conscrypt; +import static org.junit.Assert.assertEquals; + import java.io.ByteArrayInputStream; import java.math.BigInteger; import java.nio.charset.StandardCharsets; -import junit.framework.TestCase; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; -public class OpenSSLKeyTest extends TestCase { +@RunWith(JUnit4.class) +public class OpenSSLKeyTest { static final String RSA_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\n" + "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA3G7PGpfZx68wTY9eLb4b\n" + @@ -84,6 +89,7 @@ public class OpenSSLKeyTest extends TestCase { "13e6825df950a3bd4509f9d3b12da304fe5b00c443ff33326b8bfb3fe111fd4b" + "8872822c7f2832dafa0fe10d9aba22310849e978e51c8aa9da7bc1c07511d883", 16); + @Test public void test_fromPublicKeyPemInputStream() throws Exception { ByteArrayInputStream is = new ByteArrayInputStream(RSA_PUBLIC_KEY.getBytes(StandardCharsets.UTF_8)); OpenSSLKey key = OpenSSLKey.fromPublicKeyPemInputStream(is); @@ -92,6 +98,7 @@ public void test_fromPublicKeyPemInputStream() throws Exception { assertEquals(RSA_PUBLIC_EXPONENT, publicKey.getPublicExponent()); } + @Test public void test_fromPrivateKeyPemInputStream() throws Exception { ByteArrayInputStream is = new ByteArrayInputStream(RSA_PRIVATE_KEY.getBytes(StandardCharsets.UTF_8)); OpenSSLKey key = OpenSSLKey.fromPrivateKeyPemInputStream(is);