Project implements Serializable { @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((name == null) ? 0 : name.hashCode()); return result; } Project();  Project(String name); String getName(); void setName(String name); @Override int hashCode(); @Override boolean equals(Object obj);  }
@Test public void testHashCode() { project.setName("bla"); assertEquals("bla".hashCode() + 31, project.hashCode()); }