### Question:
HashData { @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof HashData)) return false; final HashData d = (HashData) o; return Arrays.equals(sha1, d.sha1) && Arrays.equals(md5, d.md5) && Arrays.equals(crc32, d.crc32) && name.equals(d.name) && size == d.size && prod_code == d.prod_code && os_code.equals(d.os_code) && special_code.equals(d.special_code); } HashData(
    byte[] sha1, byte[] md5, byte[] crc32, String name, long size,
    int prod_code, String os_code, String special_code); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); final byte[] sha1; final byte[] md5; final byte[] crc32; final String name; final long size; final int prod_code; final String os_code; final String special_code; }### Answer:
@Test public void equalsSelf() { final HashData hd = new HashData( sha1, md5, crc32, name, size, prod_code, os_code, special_code); assertTrue(hd.equals(hd)); }
@Test public void equalsSame() { final HashData a = new HashData( sha1, md5, crc32, name, size, prod_code, os_code, special_code); final HashData b = new HashData( sha1, md5, crc32, name, size, prod_code, os_code, special_code); assertTrue(a.equals(b)); assertTrue(b.equals(a)); }
@Test public void notEqualsNull() { final HashData hd = new HashData( sha1, md5, crc32, name, size, prod_code, os_code, special_code); assertFalse(hd.equals(null)); }
@Test public void notEqualsOtherType() { final HashData hd = new HashData( sha1, md5, crc32, name, size, prod_code, os_code, special_code); assertFalse(hd.equals("bogus")); assertFalse("bogus".equals(hd)); }
@Test public void notEqualsOtherDifferentProdCode() { final HashData a = new HashData( sha1, md5, crc32, name, size, prod_code, os_code, special_code); final HashData b = new HashData( sha1, md5, crc32, name, size, prod_code+1, os_code, special_code); assertFalse(a.equals(b)); assertFalse(b.equals(a)); }