예제 #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
 public void shouldCloseStatementWhenContinueWithOnOpenStatementGiven() throws SQLException {
   sqlBuilder.prepareStatement("select 1 from dual");
   sqlBuilder.continueWith();
   verify(preparedStatementMock, times(1)).close();
 }
예제 #3
0
 @Test(expected = IllegalStateException.class)
 public void shouldThrowExceptionWhenContinueOnAlreadyClosedBuilderGiven() throws SQLException {
   sqlBuilder.close();
   sqlBuilder.continueWith();
 }