예제 #1
0
 @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");
 }
예제 #2
0
 @Test(expected = IllegalStateException.class)
 public void shouldThrowExceptionWhenStringParameterWithoutStatementGiven() throws SQLException {
   sqlBuilder.withParameter("test");
 }
예제 #3
0
 @Test(expected = IllegalStateException.class)
 public void shouldThrowExceptionWhenBooleanParameterWithoutStatementGiven() throws SQLException {
   sqlBuilder.withParameter(false);
 }