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 {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user