diff --git a/src/main/java/org/springframework/data/domain/ExampleMatcher.java b/src/main/java/org/springframework/data/domain/ExampleMatcher.java index a9b4f691c..af9887884 100644 --- a/src/main/java/org/springframework/data/domain/ExampleMatcher.java +++ b/src/main/java/org/springframework/data/domain/ExampleMatcher.java @@ -556,7 +556,7 @@ public class ExampleMatcher { * @return */ public static GenericPropertyMatcher exact() { - return new GenericPropertyMatcher().startsWith(); + return new GenericPropertyMatcher().exact(); } /** diff --git a/src/test/java/org/springframework/data/repository/core/support/ExampleSpecificationAccessorUnitTests.java b/src/test/java/org/springframework/data/repository/core/support/ExampleSpecificationAccessorUnitTests.java index 945fe1f74..44625a83c 100644 --- a/src/test/java/org/springframework/data/repository/core/support/ExampleSpecificationAccessorUnitTests.java +++ b/src/test/java/org/springframework/data/repository/core/support/ExampleSpecificationAccessorUnitTests.java @@ -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; }