### Question:
ViewArtifact implements Serializable { @Override public int hashCode() { return this.artifact.hashCode(); } ViewArtifact(String artifact); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }### Answer:
@Test public void shouldSupportHashCodeAndEquals() throws Exception { ViewArtifact va1 = new ViewArtifact("a"); ViewArtifact va2 = new ViewArtifact("a"); ViewArtifact vb = new ViewArtifact("b"); assertThat(va1, is(equalTo(va2))); assertThat(va1, is(not(equalTo(vb)))); assertThat(va1.hashCode(), is(equalTo(va2.hashCode()))); assertThat(va1.hashCode(), is(not(equalTo(vb.hashCode())))); }