Skip to content

Commit e1d1a68

Browse files
committed
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().
1 parent 2377cba commit e1d1a68

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ public static GenericPropertyMatcher startsWith() {
608608
* @return
609609
*/
610610
public static GenericPropertyMatcher exact() {
611-
return new GenericPropertyMatcher().startsWith();
611+
return new GenericPropertyMatcher().exact();
612612
}
613613

614614
/**

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
* @author Mark Paluch
3939
* @soundtrack Ron Spielman Trio - Fretboard Highway (Electric Tales)
4040
*/
41-
@SuppressWarnings("unused")
4241
public class ExampleSpecificationAccessorUnitTests {
4342

4443
Person person;
@@ -322,6 +321,19 @@ public void hasPropertySpecifiersReturnsTrueWhenAtLeastOneIsSet() {
322321
assertThat(exampleSpecificationAccessor.hasPropertySpecifiers(), is(true));
323322
}
324323

324+
/**
325+
* @see DATACMNS-953
326+
*/
327+
@Test
328+
public void exactMatcherUsesExactMatching() {
329+
330+
ExampleMatcher matcher = ExampleMatcher.matching()//
331+
.withMatcher("firstname", exact());
332+
333+
assertThat(new ExampleMatcherAccessor(matcher).getPropertySpecifier("firstname").getStringMatcher(),
334+
is(StringMatcher.EXACT));
335+
}
336+
325337
static class Person {
326338
String firstname;
327339
}

0 commit comments

Comments
 (0)