NonRegisteringDriver implements Driver { @Override public boolean acceptsURL(@Nullable String url) throws SQLException { checkNotNullUrl(url); return url.startsWith(URL_PREFIX); } NonRegisteringDriver(); @VisibleForTesting  NonRegisteringDriver(TraceService traceService); @Override boolean acceptsURL(@Nullable String url); @Override Connection connect(@Nullable String url, @Nullable Properties info); @Override int getMajorVersion(); @Override int getMinorVersion(); @Override DriverPropertyInfo[] getPropertyInfo(@Nullable String url, @Nullable Properties info); @Override Logger getParentLogger(); @Override boolean jdbcCompliant();  }
@Test public void acceptsURL() throws Exception { assertThat(driver.acceptsURL("jdbc:stackdriver:")).isTrue(); assertThat( driver.acceptsURL( "jdbc:stackdriver:google:mysql: .isTrue(); assertThat(driver.acceptsURL("jdbc:google:mysql: .isFalse(); assertThat(driver.acceptsURL("jdbc:stackdriver")).isFalse(); assertThat(driver.acceptsURL("")).isFalse(); }
@Test public void acceptsURL_SQLException_for_null() { try { driver.acceptsURL(null); fail("expected SQLException"); } catch (SQLException expected) { } }