From 7d5cb748166618d5632018494d1d936e6c2d58fd Mon Sep 17 00:00:00 2001 From: Jose Almeida Date: Tue, 15 Jun 2021 17:07:55 -0300 Subject: [PATCH] Add Assert.fail() to test that should expected an exception --- .../org/apache/arrow/driver/jdbc/test/ConnectionTest.java | 7 ++++--- .../apache/arrow/driver/jdbc/test/ConnectionTlsTest.java | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/test/ConnectionTest.java b/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/test/ConnectionTest.java index f3ae050343955..94c1b96bcda2c 100644 --- a/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/test/ConnectionTest.java +++ b/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/test/ConnectionTest.java @@ -38,6 +38,7 @@ import org.apache.arrow.memory.RootAllocator; import org.apache.arrow.util.AutoCloseables; import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -149,7 +150,7 @@ public void testUnencryptedConnectionWithEmptyHost() try (Connection connection = DriverManager .getConnection(invalidUrl, properties)) { - // Shouldn't reach this since we are expecting an Exception. + Assert.fail(); } } @@ -188,7 +189,7 @@ public void testUnencryptedConnectionProvidingInvalidPort() try (Connection connection = DriverManager .getConnection(invalidUrl, properties)) { - // Shouldn't reach this since we are expecting an Exception. + Assert.fail(); } } @@ -244,7 +245,7 @@ public void testUnencryptedConnectionShouldThrowExceptionWhenProvidedWithInvalid try (Connection connection = DriverManager.getConnection(serverUrl, properties)) { - // Shouldn't reach this. + Assert.fail(); } } } diff --git a/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/test/ConnectionTlsTest.java b/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/test/ConnectionTlsTest.java index 48df0517c4d37..fa127ce6feb14 100644 --- a/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/test/ConnectionTlsTest.java +++ b/java/flight/flight-jdbc-driver/src/test/java/org/apache/arrow/driver/jdbc/test/ConnectionTlsTest.java @@ -39,6 +39,7 @@ import org.apache.arrow.util.AutoCloseables; import org.apache.calcite.avatica.org.apache.http.auth.UsernamePasswordCredentials; import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -159,7 +160,7 @@ public void testGetEncryptedClientWithNoCertificateOnKeyStore() throws Exception allocator, flightTestUtils.getLocalhost(), this.tlsServer.getPort(), null, noCertificateKeyStorePath, noCertificateKeyStorePassword)) { - // Shouldn't reach this since we are expecting an Exception. + Assert.fail(); } } @@ -197,7 +198,7 @@ public void testGetEncryptedClientWithKeyStoreBadPasswordAndNoAuth() throws Exce allocator, flightTestUtils.getLocalhost(), this.tlsServer.getPort(), null, keyStorePath, keyStoreBadPassword)) { - // Shouldn't reach this since we are expecting an Exception. + Assert.fail(); } } @@ -243,7 +244,7 @@ public void testGetAuthenticatedEncryptedConnectionWithKeyStoreBadPassword() thr try (Connection connection = DriverManager .getConnection(serverUrl, properties)) { - // Shouldn't reach this since we are expecting an Exception. + Assert.fail(); } }