DATACMNS-953 - Fixed application of GenericPropertyMatchers.exact().

We now really use exact matching for a match setup requesting exact matching. Previously, we erroneously set up the matching with a startsWith().
This commit is contained in:
Oliver Gierke
2016-12-06 10:54:14 +01:00
parent d3f235872c
commit a696484f8d
2 changed files with 14 additions and 2 deletions

View File

@@ -608,7 +608,7 @@ public class ExampleMatcher {
* @return
*/
public static GenericPropertyMatcher exact() {
return new GenericPropertyMatcher().startsWith();
return new GenericPropertyMatcher().exact();
}
/**

View File

@@ -38,7 +38,6 @@ import org.springframework.data.domain.ExampleMatcher.StringMatcher;
* @author Mark Paluch
* @soundtrack Ron Spielman Trio - Fretboard Highway (Electric Tales)
*/
@SuppressWarnings("unused")
public class ExampleSpecificationAccessorUnitTests {
Person person;
@@ -322,6 +321,19 @@ public class ExampleSpecificationAccessorUnitTests {
assertThat(exampleSpecificationAccessor.hasPropertySpecifiers(), is(true));
}
/**
* @see DATACMNS-953
*/
@Test
public void exactMatcherUsesExactMatching() {
ExampleMatcher matcher = ExampleMatcher.matching()//
.withMatcher("firstname", exact());
assertThat(new ExampleMatcherAccessor(matcher).getPropertySpecifier("firstname").getStringMatcher(),
is(StringMatcher.EXACT));
}
static class Person {
String firstname;
}