ViewEntityEntity { @Override public int hashCode() { int result = id != null ? id.hashCode() : 0; result = 31 * result + viewName.hashCode(); result = 31 * result + viewInstanceName.hashCode(); result = 31 * result + className.hashCode(); result = 31 * result + (idProperty != null ? idProperty.hashCode() : 0); return result; }  Long getId(); void setId(Long id); String getViewName(); void setViewName(String viewName); String getViewInstanceName(); void setViewInstanceName(String viewInstanceName); String getClassName(); void setClassName(String name); String getIdProperty(); void setIdProperty(String idProperty); ViewInstanceEntity getViewInstance(); void setViewInstance(ViewInstanceEntity viewInstance); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void testHashCode() throws Exception { ViewEntityEntity viewEntityEntity = new ViewEntityEntity(); viewEntityEntity.setId(99L); viewEntityEntity.setClassName("TestClass"); viewEntityEntity.setIdProperty("id"); viewEntityEntity.setViewName("foo"); viewEntityEntity.setViewInstanceName("bar"); ViewEntityEntity viewEntityEntity2 = new ViewEntityEntity(); viewEntityEntity2.setId(99L); viewEntityEntity2.setClassName("TestClass"); viewEntityEntity2.setIdProperty("id"); viewEntityEntity2.setViewName("foo"); viewEntityEntity2.setViewInstanceName("bar"); Assert.assertEquals(viewEntityEntity.hashCode(), viewEntityEntity2.hashCode()); }