Introduce @Disabled failing test for R2DBC NamedParameterUtils
Backport Bot / build (push) Waiting to run
Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run
Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run
Details
Backport Bot / build (push) Waiting to run
Details
Build and Deploy Snapshot / Build and Deploy Snapshot (push) Waiting to run
Details
Build and Deploy Snapshot / Verify (push) Blocked by required conditions
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:false version:17], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:21], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
CI / ${{ matrix.os.name}} | Java ${{ matrix.java.version}} (map[toolchain:true version:23], map[id:ubuntu-latest name:Linux]) (push) Waiting to run
Details
Deploy Docs / Dispatch docs deployment (push) Waiting to run
Details
The last assertion of the new test method currently fails since "foo" is only bound once. java.lang.AssertionError: Expected size: 2 but was: 1 in: {0="foo"} See gh-34768
This commit is contained in:
parent
ea8ae09cb7
commit
b98c3257af
|
@ -21,6 +21,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import io.r2dbc.spi.Parameters;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.ValueSource;
|
||||
|
@ -384,6 +385,45 @@ class NamedParameterUtilsTests {
|
|||
.containsEntry(2, List.of("baz"));
|
||||
}
|
||||
|
||||
@Test // gh-34768
|
||||
@Disabled("Disabled until gh-34768 is addressed")
|
||||
void multipleEqualCollectionParameterReferencesForAnonymousMarkersBindsValueTwice() {
|
||||
String sql = "SELECT * FROM fund_info WHERE fund_code IN (:fundCodes) OR fund_code IN (:fundCodes)";
|
||||
|
||||
MapBindParameterSource source = new MapBindParameterSource(Map.of("fundCodes", Parameters.in(List.of("foo"))));
|
||||
PreparedOperation<String> operation = NamedParameterUtils.substituteNamedParameters(sql, ANONYMOUS_MARKERS, source);
|
||||
|
||||
assertThat(operation.toQuery())
|
||||
.isEqualTo("SELECT * FROM fund_info WHERE fund_code IN (?) OR fund_code IN (?)");
|
||||
|
||||
Map<Integer, Object> bindings = new HashMap<>();
|
||||
|
||||
operation.bindTo(new BindTarget() {
|
||||
@Override
|
||||
public void bind(String identifier, Object value) {}
|
||||
|
||||
@Override
|
||||
public void bind(int index, Object value) {
|
||||
bindings.put(index, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindNull(String identifier, Class<?> type) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bindNull(int index, Class<?> type) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
});
|
||||
|
||||
assertThat(bindings)
|
||||
.hasSize(2)
|
||||
.containsEntry(0, "foo")
|
||||
.containsEntry(1, "foo");
|
||||
}
|
||||
|
||||
@Test
|
||||
void multipleEqualParameterReferencesForAnonymousMarkersBindsValueTwice() {
|
||||
String sql = "SELECT * FROM person where name = :id or lastname = :id";
|
||||
|
|
Loading…
Reference in New Issue