@Test(expected = IllegalStateException.class) public void shouldThrowExceptionWhenResultOnClosedStatementGiven() throws SQLException { sqlBuilder.prepareStatement("select 1 from dual"); sqlBuilder.close(); sqlBuilder.resultSet(); }
@Test public void shouldReturnResultSetWhenResultSetOnOpenStatementGiven() throws SQLException { sqlBuilder.prepareStatement("select 1 from dual"); sqlBuilder.resultSet(); verify(preparedStatementMock, times(1)).executeQuery(); }
@Test(expected = IllegalStateException.class) public void shouldThrowExceptionWhenResultWithoutStatementGiven() throws SQLException { sqlBuilder.resultSet(); }