Fault { @Override public int hashCode() { int hash = 5; hash = 29 * hash + Objects.hashCode(this.message); hash = 29 * hash + Objects.hashCode(this.classname); return hash; } Fault(Throwable t, int stacktracelength); String getMessage(); String getClassname(); String[] getStacktrace(); Throwable getThrowable(); static Fault createFromJson(String json); String toJson(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testHashCode() { System.out.println("testHashCode"); Fault a = null; Fault b = null; try { throw new Exception("Message"); } catch (Exception e) { a = new Fault(e, 5); } assertThat(a.hashCode()).isEqualTo(a.hashCode()); try { throw new IllegalAccessException("Message"); } catch (Exception e) { b = new Fault(e, 5); } assertThat(a.hashCode()).isNotEqualTo(b.hashCode()); try { throw new Exception("Message1"); } catch (Exception e) { b = new Fault(e, 5); } assertThat(a.hashCode()).isNotEqualTo(b.hashCode()); }