Skip to content

Commit d40c83d

Browse files
committed
DATAJPA-362 - Added another test case to make sure invalid like bindings are rejected.
Related ticket: DATAJPA-292.
1 parent 84a6d92 commit d40c83d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Diff for: src/test/java/org/springframework/data/jpa/repository/query/StringQueryUnitTests.java

+11
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ public void handlesMultipleNamedLikeBindingsCorrectly() {
182182
new StringQuery("select u from User u where u.firstname like %:firstname or foo like :bar");
183183
}
184184

185+
/**
186+
* @see DATAJPA-292, DATAJPA-362
187+
*/
185188
@Test(expected = IllegalArgumentException.class)
186189
public void rejectsDifferentBindingsForRepeatedParameter() {
187190
new StringQuery("select u from User u where u.firstname like %?1 and u.lastname like ?1%");
@@ -302,6 +305,14 @@ public void detectsInBindingWithSpecialCharactersAndWordCharactersMixedInParenth
302305
assertNamedBinding(InParameterBinding.class, "ab1babc생일233", bindings.get(0));
303306
}
304307

308+
/**
309+
* @see DATAJPA-362
310+
*/
311+
@Test(expected = IllegalArgumentException.class)
312+
public void rejectsDifferentBindingsForRepeatedParameter2() {
313+
new StringQuery("select u from User u where u.firstname like ?1 and u.lastname like %?1");
314+
}
315+
305316
private void assertPositionalBinding(Class<? extends ParameterBinding> bindingType, Integer position,
306317
ParameterBinding expectedBinding) {
307318

0 commit comments

Comments
 (0)