SGF-115 - Added support for Like, Contains, StartsWith and EndsWith keywords.
This commit is contained in:
@@ -44,4 +44,12 @@ public interface PersonRepository extends CrudRepository<Person, Long> {
|
||||
Collection<Person> findByFirstnameOrLastname(String firstname, String lastname);
|
||||
|
||||
Person findByLastname(String lastname);
|
||||
|
||||
Collection<Person> findByFirstnameLike(String firstname);
|
||||
|
||||
Collection<Person> findByFirstnameStartingWith(String firstname);
|
||||
|
||||
Collection<Person> findByLastnameEndingWith(String lastname);
|
||||
|
||||
Collection<Person> findByFirstnameContaining(String firstname);
|
||||
}
|
||||
|
||||
@@ -153,6 +153,38 @@ public abstract class AbstractGemfireRepositoryFactoryIntegrationTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SGF-115
|
||||
*/
|
||||
@Test
|
||||
public void executesStartsWithCorrectly() {
|
||||
assertResultsFound(repository.findByFirstnameStartingWith("Da"), dave);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SGF-115
|
||||
*/
|
||||
@Test
|
||||
public void executesEndsWithCorrectly() {
|
||||
assertResultsFound(repository.findByLastnameEndingWith("ews"), dave, oliverAugust);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SGF-115
|
||||
*/
|
||||
@Test
|
||||
public void executesContainsCorrectly() {
|
||||
assertResultsFound(repository.findByFirstnameContaining("o"), boyd, leroi);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see SGF-115
|
||||
*/
|
||||
@Test
|
||||
public void executesLikeCorrectly() {
|
||||
assertResultsFound(repository.findByFirstnameLike("Da%"), dave);
|
||||
}
|
||||
|
||||
private <T> void assertResultsFound(Iterable<T> result, T... expected) {
|
||||
|
||||
assertThat(result, is(notNullValue()));
|
||||
|
||||
Reference in New Issue
Block a user