PsqlEventSource implements EventSource { @Override public boolean isConnected() { try { return isConnectionOpen(connection) && isConnectionAlive(connection); } catch (SQLException sqle) { throw new DataAccessException(ERROR_MSG_CHECK_CONNECTION, sqle); } } PsqlEventSource(String dbUrl, String username, String password, String tableName);  PsqlEventSource(String dbUrl, String username, String password, String tableName, boolean autoConfig);  PsqlEventSource(ConnectionProvider connectionProvider, String tableName);  PsqlEventSource(ConnectionProvider connectionProvider, String tableName, boolean autoConfig); @VisibleForTesting  PsqlEventSource(ConnectionProvider connectionProvider, String tableName, PsqlEventMapper mapper,
                                       boolean autoConfig); @VisibleForTesting  PsqlEventSource(ConnectionProvider connectionProvider, String tableName, PsqlEventMapper mapper,
                           boolean autoConfig, PsqlConfigurator configurator); @Override List<Event<Map<String, Object>>> getNewEvents(); @Override void connect(); @Override void disconnect(); @Override boolean isConnected(); @Override void setup(); @Override void cleanup();  }
@Test(groups = SMALL) public void testConnectCreatesNewConnectionIfConnectionIsNotAlive() throws SQLException { doThrow(new SQLException()).when(mockedConnection).createStatement(); assertFalse(eventSource.isConnected()); }
@Test(groups = SMALL) public void testIsConnectedReturnsFalseOnInitialization() { assertFalse(eventSource.isConnected()); }