Fix StringSequence.equals() for different lengths

See gh-15465
This commit is contained in:
dreis2211 2018-12-14 12:07:51 +01:00 committed by Stephane Nicoll
parent 64c6b9c648
commit 2a0680c2ba
2 changed files with 8 additions and 1 deletions

View File

@ -126,7 +126,7 @@ final class StringSequence implements CharSequence {
}
return true;
}
return true;
return false;
}
@Override

View File

@ -167,6 +167,13 @@ public class StringSequenceTests {
assertThat(a).isEqualTo(b).isNotEqualTo(c);
}
@Test
public void notEqualsWhenSequencesOfDifferentLength() {
StringSequence a = new StringSequence("abcd");
StringSequence b = new StringSequence("ef");
assertThat(a).isNotEqualTo(b);
}
@Test
public void startsWithWhenExactMatch() {
assertThat(new StringSequence("abc").startsWith("abc")).isTrue();