@@ -135,13 +135,14 @@ public void testRegister() throws SQLException {
135
135
136
136
@ Test
137
137
public void testConnect () throws SQLException {
138
- try (Connection connection =
139
- DriverManager .getConnection (
140
- String .format (
141
- "jdbc:cloudspanner://localhost:%d/projects/some-company.com:test-project/instances/static-test-instance/databases/test-database;usePlainText=true;credentials=%s" ,
142
- server .getPort (), TEST_KEY_PATH ))) {
143
- assertThat (connection .isClosed ()).isFalse ();
144
- }
138
+ for (String prefix : new String [] {"cloudspanner" , "spanner" })
139
+ try (Connection connection =
140
+ DriverManager .getConnection (
141
+ String .format (
142
+ "jdbc:%s://localhost:%d/projects/some-company.com:test-project/instances/static-test-instance/databases/test-database;usePlainText=true;credentials=%s" ,
143
+ prefix , server .getPort (), TEST_KEY_PATH ))) {
144
+ assertThat (connection .isClosed ()).isFalse ();
145
+ }
145
146
}
146
147
147
148
@ Test (expected = SQLException .class )
@@ -215,6 +216,17 @@ public void testLenient() throws SQLException {
215
216
}
216
217
}
217
218
219
+ @ Test
220
+ public void testAcceptsURL () throws SQLException {
221
+ JdbcDriver driver = JdbcDriver .getRegisteredDriver ();
222
+ assertTrue (
223
+ driver .acceptsURL (
224
+ "jdbc:cloudspanner:/projects/my-project/instances/my-instance/databases/my-database" ));
225
+ assertTrue (
226
+ driver .acceptsURL (
227
+ "jdbc:spanner:/projects/my-project/instances/my-instance/databases/my-database" ));
228
+ }
229
+
218
230
@ Test
219
231
public void testJdbcExternalHostFormat () {
220
232
Matcher matcherWithoutInstance =
0 commit comments