@Test public void shouldResetParameterIndexWhenContinueWithOnOpenStatementGiven() throws SQLException { sqlBuilder.prepareStatement("select 1 from dual"); sqlBuilder.withParameter(true); sqlBuilder.withParameter(false); sqlBuilder.continueWith().prepareStatement("select 2 from dual"); sqlBuilder.withParameter("test"); verify(preparedStatementMock, times(1)).setBoolean(1, true); verify(preparedStatementMock, times(1)).setBoolean(2, false); verify(preparedStatementMock, times(1)).setString(1, "test"); }
@Test(expected = IllegalStateException.class) public void shouldThrowExceptionWhenStringParameterWithoutStatementGiven() throws SQLException { sqlBuilder.withParameter("test"); }
@Test(expected = IllegalStateException.class) public void shouldThrowExceptionWhenBooleanParameterWithoutStatementGiven() throws SQLException { sqlBuilder.withParameter(false); }