DATACMNS-879 - ExampleMatcher now allows to define whether all or any match should be used.
Introduced dedicated factory methods for ExampleMatcher so that it exposes whether the predicates built from Example instances have to be fulfilled all or if it's sufficient that any of them matches.
This commit is contained in:
@@ -29,6 +29,7 @@ import org.springframework.data.domain.ExampleMatcher.StringMatcher;
|
||||
* Unit test for {@link ExampleMatcher}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author Oliver Gierke
|
||||
* @soundtrack K2 - Der Berg Ruft (Club Mix)
|
||||
*/
|
||||
public class ExampleMatcherUnitTests {
|
||||
@@ -176,6 +177,36 @@ public class ExampleMatcherUnitTests {
|
||||
assertThat(configuredExampleSpec.isIgnoreCaseEnabled(), is(true));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-879
|
||||
*/
|
||||
@Test
|
||||
public void defaultMatcherRequiresAllMatching() {
|
||||
|
||||
assertThat(matching().isAllMatching(), is(true));
|
||||
assertThat(matching().isAnyMatching(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-879
|
||||
*/
|
||||
@Test
|
||||
public void allMatcherRequiresAllMatching() {
|
||||
|
||||
assertThat(matchingAll().isAllMatching(), is(true));
|
||||
assertThat(matchingAll().isAnyMatching(), is(false));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACMNS-879
|
||||
*/
|
||||
@Test
|
||||
public void anyMatcherYieldsAnyMatching() {
|
||||
|
||||
assertThat(matchingAny().isAnyMatching(), is(true));
|
||||
assertThat(matchingAny().isAllMatching(), is(false));
|
||||
}
|
||||
|
||||
static class Person {
|
||||
|
||||
String firstname;
|
||||
|
||||
Reference in New Issue
Block a user