RequestCode { @Override public int hashCode() { return requestCode; } RequestCode(final int requestCode); @Override boolean equals(final Object o); @Override int hashCode(); final int requestCode; }
@Test public void hashCodes() { assertEquals(new RequestCode(3).hashCode(), new RequestCode(3).hashCode()); assertNotEquals(new RequestCode(5).hashCode(), new RequestCode(3).hashCode()); }