Skip to content
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

ConfigurationPropertyName#equals is not symmetric when element has trailing dashes #34804

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 @@ -406,7 +406,7 @@ private boolean dashIgnoringElementEquals(Elements e1, Elements e2, int i) {
int i2 = 0;
while (i1 < l1) {
if (i2 >= l2) {
return false;
return remainderIsNotAlphanumeric(e1, i, i1);
}
char ch1 = e1.charAt(i, i1);
char ch2 = e2.charAt(i, i2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,14 @@ void equalsWhenAdaptedNameMatchesDueToRemovalOfTrailingCharacters() {
assertThat(name2).isEqualTo(name1);
}

@Test
void equalsSymmetricWhenNameMatchesDueToRemovalOfTrailingDashes() {
ConfigurationPropertyName n1 = ConfigurationPropertyName.of("foobar");
ConfigurationPropertyName n2 = ConfigurationPropertyName.of("foobar--");
assertThat(n1).isEqualTo(n2);
assertThat(n2).isEqualTo(n1);
}

@Test
void isValidWhenValidShouldReturnTrue() {
assertThat(ConfigurationPropertyName.isValid("")).isTrue();
Expand Down