Browse Source

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().
pull/347/head
Oliver Gierke 9 years ago
parent
commit
0aa37e0b28
  1. 2
      src/main/java/org/springframework/data/domain/ExampleMatcher.java
  2. 14
      src/test/java/org/springframework/data/repository/core/support/ExampleSpecificationAccessorUnitTests.java

2
src/main/java/org/springframework/data/domain/ExampleMatcher.java

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

14
src/test/java/org/springframework/data/repository/core/support/ExampleSpecificationAccessorUnitTests.java

@ -38,7 +38,6 @@ import org.springframework.data.domain.ExampleMatcher.StringMatcher; @@ -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 { @@ -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;
}

Loading…
Cancel
Save