Skip to content

Commit a13c2c8

Browse files
committed
spring-projects#282 - Add test of 'IS NULL' condition
1 parent 90c84df commit a13c2c8

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: src/test/java/org/springframework/data/r2dbc/repository/query/PartTreeR2dbcQueryIntegrationTests.java

+10
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ public void createsQueryToFindAllEntitiesByStringAttribute() throws Exception {
7171
.isEqualTo("SELECT users.id, users.first_name FROM users WHERE users.first_name = ?");
7272
}
7373

74+
@Test
75+
public void createsQueryWithIsNullCondition() throws Exception {
76+
R2dbcQueryMethod queryMethod = getQueryMethod("findAllByFirstName", String.class);
77+
PartTreeR2dbcQuery r2dbcQuery = new PartTreeR2dbcQuery(queryMethod, databaseClient, r2dbcConverter,
78+
dataAccessStrategy);
79+
BindableQuery bindableQuery = r2dbcQuery.createQuery((getAccessor(queryMethod, new Object[]{null})));
80+
assertThat(bindableQuery.get())
81+
.isEqualTo("SELECT users.id, users.first_name FROM users WHERE users.first_name IS NULL");
82+
}
83+
7484
private R2dbcQueryMethod getQueryMethod(String methodName, Class<?>... parameterTypes) throws Exception {
7585
Method method = UserRepository.class.getMethod(methodName, parameterTypes);
7686
return new R2dbcQueryMethod(method, new DefaultRepositoryMetadata(UserRepository.class),

0 commit comments

Comments
 (0)