Injectable { @Override public int hashCode() { return Objects.hash(cls, supplier); } Injectable(Class<T> cls, Supplier<T> supplier); Class<T> get(); Supplier<T> supplier(); @Override boolean equals(Object o); @Override int hashCode();  }
@Test void testHashCode() { final int injectable1 = new Injectable<>(Integer.class, SUPPLIER).hashCode(); final int injectable2 = new Injectable<>(Integer.class, SUPPLIER).hashCode(); assertEquals(injectable1, injectable1); assertEquals(injectable2, injectable2); assertEquals(injectable1, injectable2); assertEquals(injectable2, injectable1); }