Skip to content

Commit 2b2995a

Browse files
DATAREDIS-771 - Polishing.
Add test and update documentation. Original Pull Request: spring-projects#342
1 parent 86606be commit 2b2995a

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

src/main/asciidoc/reference/redis-repositories.adoc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,9 @@ The following table provides an overview of the keywords supported for Redis and
696696
|Keyword|Sample|Redis snippet
697697
|`And`|`findByLastnameAndFirstname`|`SINTER …:firstname:rand …:lastname:al’thor`
698698
|`Or`|`findByLastnameOrFirstname`|`SUNION …:firstname:rand …:lastname:al’thor`
699-
|`Is,Equals`|`findByFirstname`,`findByFirstnameIs`,`findByFirstnameEquals`|`SINTER …:firstname:rand`
699+
|`Is, Equals`|`findByFirstname`, `findByFirstnameIs`, `findByFirstnameEquals`|`SINTER …:firstname:rand`
700+
|`IsTrue` | `FindByAliveIsTrue` | `SINTER …:alive:1`
701+
|`IsFalse` | `findByAliveIsFalse` | `SINTER …:alive:0`
700702
|`Top,First`|`findFirst10ByFirstname`,`findTop5ByFirstname`|
701703
|===============
702704
====

src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTestBase.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@ public void shouldFindByBooleanIsTrue() {
232232

233233
Person robb = new Person("robb", "stark");
234234
robb.setAlive(false);
235+
235236
Person jon = new Person("jon", "snow");
236237

237238
repo.saveAll(Arrays.asList(eddard, robb, jon));
@@ -242,6 +243,25 @@ public void shouldFindByBooleanIsTrue() {
242243
assertThat(result, contains(eddard));
243244
}
244245

246+
@Test // DATAREDIS-771
247+
public void shouldFindByBooleanIsFalse() {
248+
249+
Person eddard = new Person("eddard", "stark");
250+
eddard.setAlive(true);
251+
252+
Person robb = new Person("robb", "stark");
253+
robb.setAlive(false);
254+
255+
Person jon = new Person("jon", "snow");
256+
257+
repo.saveAll(Arrays.asList(eddard, robb, jon));
258+
259+
List<Person> result = repo.findPersonByAliveIsFalse();
260+
261+
assertThat(result, hasSize(1));
262+
assertThat(result, contains(robb));
263+
}
264+
245265
@Test // DATAREDIS-547
246266
public void shouldReturnEmptyListWhenPageableOutOfBoundsUsingFindAll() {
247267

@@ -394,6 +414,8 @@ public static interface PersonRepository
394414

395415
List<Person> findPersonByAliveIsTrue();
396416

417+
List<Person> findPersonByAliveIsFalse();
418+
397419
List<Person> findByFirstnameAndLastname(String firstname, String lastname);
398420

399421
List<Person> findByFirstnameOrLastname(String firstname, String lastname);

src/test/java/org/springframework/data/redis/repository/RedisRepositoryIntegrationTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public class RedisRepositoryIntegrationTests extends RedisRepositoryIntegrationT
5757
keyspaceConfiguration = MyKeyspaceConfiguration.class,
5858
includeFilters = { @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE,
5959
classes = { PersonRepository.class, CityRepository.class }) })
60+
6061
static class Config {
6162

6263
@Bean

0 commit comments

Comments
 (0)