DATACMNS-1304 - Polishing.
Moved test cases into PropertyPathUnit test so that they're closer to the implementation. Switched to Introspector.decapitalize(…) to follow the Java Beans Specification regarding the handling of all-uppercase properties. Original pull request: #289.
This commit is contained in:
@@ -386,6 +386,21 @@ public class PropertyPathUnitTests {
|
||||
.isThrownBy(() -> PropertyPath.from(path, Left.class));
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1304
|
||||
public void resolvesPropertyPathWithSingleUppercaseLetterPropertyEnding() {
|
||||
assertThat(from("categoryB", Product.class).toDotPath()).isEqualTo("categoryB");
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1304
|
||||
public void resolvesPropertyPathWithUppercaseLettersPropertyEnding() {
|
||||
assertThat(from("categoryABId", Product.class).toDotPath()).isEqualTo("categoryAB.id");
|
||||
}
|
||||
|
||||
@Test // DATACMNS-1304
|
||||
public void detectsNestedSingleCharacterProperty() {
|
||||
assertThat(from("category_B", Product.class).toDotPath()).isEqualTo("category.b");
|
||||
}
|
||||
|
||||
private class Foo {
|
||||
|
||||
String userName;
|
||||
@@ -430,4 +445,18 @@ public class PropertyPathUnitTests {
|
||||
private class Right {
|
||||
Left bar;
|
||||
}
|
||||
|
||||
// DATACMNS-1304
|
||||
private class Product {
|
||||
Category category;
|
||||
Category categoryB;
|
||||
Category categoryAB;
|
||||
}
|
||||
|
||||
private class Category {
|
||||
B b;
|
||||
String id;
|
||||
}
|
||||
|
||||
private class B {}
|
||||
}
|
||||
|
||||
@@ -601,16 +601,6 @@ public class PartTreeUnitTests {
|
||||
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);
|
||||
}
|
||||
@@ -734,10 +724,6 @@ public class PartTreeUnitTests {
|
||||
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 {
|
||||
|
||||
Reference in New Issue
Block a user