#468 - Correctly map result of exists queries.

We now map results of exists queries to a boolean flag to ensure proper decoding. Previously, results were attempted to be mapped onto a primitive type which failed as there's no converter registered for Row to Boolean.
This commit is contained in:
Mark Paluch
2020-09-21 15:17:45 +02:00
parent f0b30f0ca0
commit d3823947aa
5 changed files with 101 additions and 7 deletions

View File

@@ -296,6 +296,33 @@ public abstract class AbstractR2dbcRepositoryIntegrationTests extends R2dbcInteg
.verifyComplete();
}
@Test // gh-363
void derivedQueryWithCount() {
shouldInsertNewItems();
repository.countByNameContains("SCH") //
.as(StepVerifier::create) //
.assertNext(i -> assertThat(i).isEqualTo(2)) //
.verifyComplete();
}
@Test // gh-468
void derivedQueryWithExists() {
shouldInsertNewItems();
repository.existsByName("ABS") //
.as(StepVerifier::create) //
.expectNext(Boolean.FALSE) //
.verifyComplete();
repository.existsByName("SCHAUFELRADBAGGER") //
.as(StepVerifier::create) //
.expectNext(true) //
.verifyComplete();
}
@Test // gh-421
void shouldDeleteAllAndReturnCount() {
@@ -345,6 +372,8 @@ public abstract class AbstractR2dbcRepositoryIntegrationTests extends R2dbcInteg
Mono<Integer> deleteAllAndReturnCount();
Mono<Integer> countByNameContains(String namePart);
Mono<Boolean> existsByName(String name);
}
@Getter