@ParameterizedTest @ArgumentsSource(TestCaseArgumentsProvider.class) @TestCase({"SHARE", " for read only with rs use and keep SHARE locks"}) @TestCase({"UPDATE", " for read only with rs use and keep UPDATE locks"}) @TestCase({"EXCLUSIVE", " for read only with rs use and keep EXCLUSIVE locks"}) void keepLocks(LockLevel level, String lockSql) { SelectStatement<Integer> sut = new SelectStatement<>(createScope(), TypeToken.of(Integer.class), from, rowMapper, projection); sut.keepLocks(level); when(projection.sql(any())).thenReturn("col1"); when(from.sql(any())).thenReturn(" from tab1"); assertThat(sut.sql(), is("select col1 from tab1" + lockSql)); }
void keepLocks(LockLevel level) { keepLocks = Optional.of(level); }
SelectStatement { void keepLocks(LockLevel level) { keepLocks = Optional.of(level); } }
SelectStatement { void keepLocks(LockLevel level) { keepLocks = Optional.of(level); } SelectStatement(Scope scope, TypeToken<RT> rowType, From from, RowMapper<RT> rowMapper, Projection projection); }
SelectStatement { void keepLocks(LockLevel level) { keepLocks = Optional.of(level); } SelectStatement(Scope scope, TypeToken<RT> rowType, From from, RowMapper<RT> rowMapper, Projection projection); TypeToken<RT> rowType(); Stream<CommonTableExpression<?>> commonTableExpressions(); }
SelectStatement { void keepLocks(LockLevel level) { keepLocks = Optional.of(level); } SelectStatement(Scope scope, TypeToken<RT> rowType, From from, RowMapper<RT> rowMapper, Projection projection); TypeToken<RT> rowType(); Stream<CommonTableExpression<?>> commonTableExpressions();  }