@Test(groups = SMALL, expectedExceptions = IllegalStateException.class) public void testCallingGetNewEventsWithoutCallingConnectThrowsException() { MysqlEventSource eventSource = new MysqlEventSource(provider, TEST_TABLE_NAME); eventSource.getNewEvents(); }
@Override public List<Event<Map<String, Object>>> getNewEvents() throws DataAccessException { if (!isConnected()) { throw new IllegalStateException("Calling getNewEvents without first connecting"); } return mapMysqlEventsToGenericEvents(eventRepo.getNewEventsForListener(listener, connection)); }
MysqlEventSource implements EventSource { @Override public List<Event<Map<String, Object>>> getNewEvents() throws DataAccessException { if (!isConnected()) { throw new IllegalStateException("Calling getNewEvents without first connecting"); } return mapMysqlEventsToGenericEvents(eventRepo.getNewEventsForListener(listener, connection)); } }
MysqlEventSource implements EventSource { @Override public List<Event<Map<String, Object>>> getNewEvents() throws DataAccessException { if (!isConnected()) { throw new IllegalStateException("Calling getNewEvents without first connecting"); } return mapMysqlEventsToGenericEvents(eventRepo.getNewEventsForListener(listener, connection)); } MysqlEventSource(ConnectionProvider connectionProvider, String tableName); @VisibleForTesting  MysqlEventSource(ConnectionProvider connectionProvider, String tableName, MysqlConfigurator configurator); }
MysqlEventSource implements EventSource { @Override public List<Event<Map<String, Object>>> getNewEvents() throws DataAccessException { if (!isConnected()) { throw new IllegalStateException("Calling getNewEvents without first connecting"); } return mapMysqlEventsToGenericEvents(eventRepo.getNewEventsForListener(listener, connection)); } MysqlEventSource(ConnectionProvider connectionProvider, String tableName); @VisibleForTesting  MysqlEventSource(ConnectionProvider connectionProvider, String tableName, MysqlConfigurator configurator); @Override List<Event<Map<String, Object>>> getNewEvents(); @Override void connect(); @Override void disconnect(); @Override boolean isConnected(); @Override void setup(); @Override void cleanup(); }
MysqlEventSource implements EventSource { @Override public List<Event<Map<String, Object>>> getNewEvents() throws DataAccessException { if (!isConnected()) { throw new IllegalStateException("Calling getNewEvents without first connecting"); } return mapMysqlEventsToGenericEvents(eventRepo.getNewEventsForListener(listener, connection)); } MysqlEventSource(ConnectionProvider connectionProvider, String tableName); @VisibleForTesting  MysqlEventSource(ConnectionProvider connectionProvider, String tableName, MysqlConfigurator configurator); @Override List<Event<Map<String, Object>>> getNewEvents(); @Override void connect(); @Override void disconnect(); @Override boolean isConnected(); @Override void setup(); @Override void cleanup();  }