Skip to content

Commit

Permalink
Fix StringSequence.equals() for different lengths
Browse files Browse the repository at this point in the history
  • Loading branch information
dreis2211 authored and snicoll committed Dec 17, 2018
1 parent 64c6b9c commit 2a0680c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public boolean equals(Object obj) {
}
return true;
}
return true;
return false;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,13 @@ public void equalsWhenSameContentShouldMatch() {
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();
Expand Down

0 comments on commit 2a0680c

Please sign in to comment.