DATACMNS-399 - Support query prefix to designate repository query methods.
Extended PREFIX regex in PartTree to support the "query" prefix. Original author: @jiming Original pull request: #56.
This commit is contained in:
committed by
Oliver Gierke
parent
ba89dc9bb4
commit
eddb3323de
@@ -44,7 +44,7 @@ import org.springframework.data.repository.query.parser.PartTree.OrPart;
|
||||
*/
|
||||
public class PartTreeUnitTests {
|
||||
|
||||
private String[] PREFIXES = { "find", "read", "get" };
|
||||
private String[] PREFIXES = { "find", "read", "get", "query" };
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void rejectsNullSource() throws Exception {
|
||||
@@ -417,6 +417,19 @@ public class PartTreeUnitTests {
|
||||
assertThat(tree.isCountProjection(), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-399
|
||||
*/
|
||||
@Test
|
||||
public void queryPrefixShouldBeSupportedInRepositoryQueryMethods() {
|
||||
|
||||
PartTree tree = new PartTree("queryByFirstnameAndLastname", User.class);
|
||||
Iterable<Part> parts = tree.getParts();
|
||||
|
||||
assertThat(parts, hasItem(part("firstname")));
|
||||
assertThat(parts, hasItem(part("lastname")));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-303
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user