gaborgsomogyi commented on a change in pull request #33370:
URL: https://github.com/apache/spark/pull/33370#discussion_r671033161



##########
File path: 
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/jdbc/connection/ConnectionProviderSuite.scala
##########
@@ -45,6 +54,84 @@ class ConnectionProviderSuite extends 
ConnectionProviderSuiteBase with SharedSpa
     }
   }
 
+  test("Throw an error selecting from an empty list of providers on create") {
+    val providerBase = new ConnectionProviderBase() {
+      override val providers = Seq.empty
+    }
+
+    val err1 = intercept[IllegalArgumentException] {
+      providerBase.create(mock[Driver], Map.empty, None)
+    }
+    assert(err1.getMessage.contains("Empty list of JDBC connection providers"))
+
+    val err2 = intercept[IllegalArgumentException] {
+      providerBase.create(mock[Driver], Map.empty, Some("test"))
+    }
+    assert(err2.getMessage.contains("Empty list of JDBC connection providers"))
+  }
+
+  test("Throw an error when more than one provider is available on create") {
+    val provider1 = new JdbcConnectionProvider() {

Review comment:
       I have the feeling that `TestJdbcConnectionProvider(val name, val 
getConnectionImpl...)` class can be created in a common area. Such way several 
copy-paste can be eliminated, right?




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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to