|
|
@ -26,6 +26,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
* Tests for {@link AsciiBytes}.
|
|
|
|
* Tests for {@link AsciiBytes}.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @author Phillip Webb
|
|
|
|
* @author Phillip Webb
|
|
|
|
|
|
|
|
* @author Andy Wilkinson
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
public class AsciiBytesTests {
|
|
|
|
public class AsciiBytesTests {
|
|
|
|
|
|
|
|
|
|
|
@ -140,16 +141,26 @@ public class AsciiBytesTests {
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void hashCodeSameAsString() throws Exception {
|
|
|
|
public void hashCodeSameAsString() throws Exception {
|
|
|
|
String s = "abcABC123xyz!";
|
|
|
|
hashCodeSameAsString("abcABC123xyz!");
|
|
|
|
AsciiBytes a = new AsciiBytes(s);
|
|
|
|
|
|
|
|
assertThat(s.hashCode()).isEqualTo(a.hashCode());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|
public void hashCodeSameAsStringWithSpecial() throws Exception {
|
|
|
|
public void hashCodeSameAsStringWithSpecial() throws Exception {
|
|
|
|
String s = "special/\u00EB.dat";
|
|
|
|
hashCodeSameAsString("special/\u00EB.dat");
|
|
|
|
AsciiBytes a = new AsciiBytes(s);
|
|
|
|
}
|
|
|
|
assertThat(s.hashCode()).isEqualTo(a.hashCode());
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void hashCodeSameAsStringWithCyrillicCharacters() throws Exception {
|
|
|
|
|
|
|
|
hashCodeSameAsString("\u0432\u0435\u0441\u043D\u0430");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
|
|
|
public void hashCodeSameAsStringWithEmoji() throws Exception {
|
|
|
|
|
|
|
|
hashCodeSameAsString("\ud83d\udca9");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void hashCodeSameAsString(String input) {
|
|
|
|
|
|
|
|
assertThat(new AsciiBytes(input).hashCode()).isEqualTo(input.hashCode());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|