@Test public void shouldThrowStorageExceptionIfStoreCannotBeInitializedBecauseAddDatabaseCreateStatementsToBatchThrows() throws Exception { when(mockDriver.connect(anyString(), any(Properties.class))).thenReturn(mockConnection); when(mockConnection.createStatement()).thenReturn(mockStatement); doThrow(new IllegalArgumentException("database broken")).when(jdbcTestSubclass).addDatabaseCreateStatementsToBatch(mockStatement); assertThatInitializeThrows(IllegalArgumentException.class); InOrder inOrder = inOrder(mockStatement, mockConnection); inOrder.verify(mockStatement).close(); inOrder.verify(mockConnection).rollback(); inOrder.verify(mockConnection).close(); }
protected abstract void addDatabaseCreateStatementsToBatch(Statement statement) throws Exception;
JDBCBase { protected abstract void addDatabaseCreateStatementsToBatch(Statement statement) throws Exception; }
JDBCBase { protected abstract void addDatabaseCreateStatementsToBatch(Statement statement) throws Exception; protected  JDBCBase(String url, String username, @Nullable String password); }
JDBCBase { protected abstract void addDatabaseCreateStatementsToBatch(Statement statement) throws Exception; protected  JDBCBase(String url, String username, @Nullable String password); synchronized final void initialize(); synchronized final void teardown(); }
JDBCBase { protected abstract void addDatabaseCreateStatementsToBatch(Statement statement) throws Exception; protected  JDBCBase(String url, String username, @Nullable String password); synchronized final void initialize(); synchronized final void teardown();  }