Skip to content

Commit 7afde2b

Browse files
committed
Add another ConfigurationPropertyName.equals test
Include an additional test to ensure that `.equals` works for names starting with the same value. See gh-14665
1 parent 923e47e commit 7afde2b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

spring-boot-project/spring-boot/src/test/java/org/springframework/boot/context/properties/source/ConfigurationPropertyNameTests.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,15 @@ public void equalsAndHashCode() {
582582
assertThat((Object) n14).isNotEqualTo(n15);
583583
}
584584

585+
@Test
586+
public void equalsWhenStartsWith() {
587+
// gh-14665
588+
ConfigurationPropertyName n1 = ConfigurationPropertyName.of("my.sources[0].xame");
589+
ConfigurationPropertyName n2 = ConfigurationPropertyName
590+
.of("my.sources[0].xamespace");
591+
assertThat(n1).isNotEqualTo(n2);
592+
}
593+
585594
@Test
586595
public void isValidWhenValidShouldReturnTrue() {
587596
assertThat(ConfigurationPropertyName.isValid("")).isTrue();

0 commit comments

Comments
 (0)