DATAKV-90 - Add findAll variant with QueryDSL OrderSpecifier without a Predicate.

This commit is contained in:
Christoph Strobl
2014-11-28 15:06:08 +01:00
parent 5f62882a3e
commit 4f37a7ecc3
2 changed files with 48 additions and 2 deletions

View File

@@ -122,6 +122,32 @@ public class QueryDslMapRepositoryUnitTests extends SimpleKeyValueRepositoryUnit
assertThat(result, contains(JAIME, CERSEI));
}
/**
* @see DATAKV-90
*/
@Test
public void findAllWithOrderSpecifierWorksCorrectly() {
repository.save(LENNISTERS);
Iterable<Person> result = getQPersonRepo().findAll(new QSort(QPerson.person.firstname.desc()));
assertThat(result, contains(TYRION, JAIME, CERSEI));
}
/**
* @see DATAKV-90
*/
@Test
public void findAllShouldIgnoreNullOrderSpecifier() {
repository.save(LENNISTERS);
Iterable<Person> result = getQPersonRepo().findAll((QSort) null);
assertThat(result, containsInAnyOrder(TYRION, JAIME, CERSEI));
}
@Override
protected Class<? extends PersonRepository> getRepositoryClass() {
return QPersonRepository.class;