Search in sources :

Example 1 with Person

use of org.springframework.data.keyvalue.Person in project spring-data-keyvalue by spring-projects.

the class AbstractRepositoryUnitTests method findsByValueInCollectionCorrectlyWhenTargetPathAndCollectionContainNullValue.

// DATAKV-169
@Test
public void findsByValueInCollectionCorrectlyWhenTargetPathAndCollectionContainNullValue() {
    repository.saveAll(LENNISTERS);
    Person personWithNullAsFirstname = new Person(null, 10);
    repository.save(personWithNullAsFirstname);
    List<Person> result = repository.findByFirstnameIn(Arrays.asList(CERSEI.getFirstname(), JAIME.getFirstname(), null));
    assertThat(result, hasSize(3));
    assertThat(result, is(containsInAnyOrder(CERSEI, JAIME, personWithNullAsFirstname)));
}
Also used : Person(org.springframework.data.keyvalue.Person) QPerson(org.springframework.data.keyvalue.QPerson) Test(org.junit.Test)

Example 2 with Person

use of org.springframework.data.keyvalue.Person in project spring-data-keyvalue by spring-projects.

the class AbstractRepositoryUnitTests method findsByValueInCollectionCorrectlyWhenTargetPathContainsNullValue.

// DATAKV-169
@Test
public void findsByValueInCollectionCorrectlyWhenTargetPathContainsNullValue() {
    repository.saveAll(LENNISTERS);
    repository.save(new Person(null, 10));
    List<Person> result = repository.findByFirstnameIn(Arrays.asList(CERSEI.getFirstname(), JAIME.getFirstname()));
    assertThat(result, hasSize(2));
    assertThat(result, is(containsInAnyOrder(CERSEI, JAIME)));
}
Also used : Person(org.springframework.data.keyvalue.Person) QPerson(org.springframework.data.keyvalue.QPerson) Test(org.junit.Test)

Example 3 with Person

use of org.springframework.data.keyvalue.Person in project spring-data-keyvalue by spring-projects.

the class QuerydslKeyValueRepositoryUnitTests method findAllWithOrderSpecifierWorksCorrectly.

// DATAKV-90
@Test
public void findAllWithOrderSpecifierWorksCorrectly() {
    repository.saveAll(LENNISTERS);
    Iterable<Person> result = repository.findAll(new QSort(QPerson.person.firstname.desc()));
    assertThat(result, contains(TYRION, JAIME, CERSEI));
}
Also used : QSort(org.springframework.data.querydsl.QSort) Person(org.springframework.data.keyvalue.Person) QPerson(org.springframework.data.keyvalue.QPerson) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 Person (org.springframework.data.keyvalue.Person)3 QPerson (org.springframework.data.keyvalue.QPerson)3 QSort (org.springframework.data.querydsl.QSort)1