PagedResultsCookie { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PagedResultsCookie that = (PagedResultsCookie) o; if (!Arrays.equals(cookie, that.cookie)) return false; return true; } PagedResultsCookie(byte[] cookie); byte[] getCookie(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testEquals() { byte[] expectedCookie = new byte[] { 1, 2 }; byte[] differentCookie = new byte[] { 2, 3 }; PagedResultsCookie originalObject = new PagedResultsCookie( expectedCookie); PagedResultsCookie identicalObject = new PagedResultsCookie( expectedCookie); PagedResultsCookie differentObject = new PagedResultsCookie( differentCookie); PagedResultsCookie subclassObject = new PagedResultsCookie( expectedCookie) { }; new EqualsTester(originalObject, identicalObject, differentObject, subclassObject); }