Skip to content

Commit

Permalink
Fix asymmetry of equals when element has trailing dashes
Browse files Browse the repository at this point in the history
  • Loading branch information
eydunn authored and wilkinsona committed Jun 30, 2023
1 parent 7b565bd commit a86429a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
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 @@ -702,6 +702,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

0 comments on commit a86429a

Please sign in to comment.