JDBCBase { public synchronized final void initialize() throws StorageException { checkState(!initialized); try { setupConnection(); Statement statement = connection.createStatement(); checkNotNull(statement); try { try { addDatabaseCreateStatementsToBatch(statement); statement.executeBatch(); } finally { closeSilently(statement); } connection.commit(); initialized = true; } finally { if (!initialized) { connection.rollback(); } } } catch (Exception e) { throw new StorageException(e); } finally { if (!initialized) { cleanupConnection(); } } } protected  JDBCBase(String url, String username, @Nullable String password); synchronized final void initialize(); synchronized final void teardown();  }
@Test public void shouldThrowStorageExceptionIfStoreCannotBeInitializedBecauseNoDriverIsFound() throws SQLException, StorageException { when(mockDriver.connect(anyString(), any(Properties.class))).thenReturn(null); expectedException.expect(StorageException.class); expectedException.expectCause(Matchers.<Throwable>instanceOf(SQLException.class)); jdbcTestSubclass.initialize(); }