Skip to content

DATACMNS-1304 - Property path with uppercase letters at the end finding #289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
* @author Oliver Gierke
* @author Christoph Strobl
* @author Mark Paluch
* @author Mariusz Mączkowski
*/
@EqualsAndHashCode
public class PropertyPath implements Streamable<PropertyPath> {
Expand Down Expand Up @@ -401,7 +402,7 @@ private static PropertyPath create(String source, TypeInformation<?> type, Strin
exception = e;
}

Pattern pattern = Pattern.compile("\\p{Lu}+\\p{Ll}*$");
Pattern pattern = Pattern.compile("\\p{Lu}\\p{Ll}*$");
Matcher matcher = pattern.matcher(source);

if (matcher.find() && matcher.start() != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
* @author Christoph Strobl
* @author Mark Paluch
* @author Michael Cramer
* @author Mariusz Mączkowski
*/
public class PartTreeUnitTests {

Expand Down Expand Up @@ -600,6 +601,16 @@ public void emptyTreeDoesNotContainParts() {
assertThat(tree.hasPredicate()).isFalse();
}

@Test // DATACMNS-1304
public void resolvesPropertyPathWithSingleUppercaseLetterPropertyEnding() {
assertThat(new PartTree("findByCategoryBId", Product.class)).isNotNull();
}

@Test // DATACMNS-1304
public void resolvesPropertyPathWithUppercaseLettersPropertyEnding() {
assertThat(new PartTree("findByCategoryABId", Product.class)).isNotNull();
}

private static void assertLimiting(String methodName, Class<?> entityType, boolean limiting, Integer maxResults) {
assertLimiting(methodName, entityType, limiting, maxResults, false);
}
Expand Down Expand Up @@ -723,6 +734,10 @@ interface Product {
Anders getAnders(); // constains And keyword

Category getCategory();

Category getCategoryB(); // contains single uppercase letter at the end

Category getCategoryAB(); // contains uppercase letters at the end
}

interface Category {
Expand Down