ViewEntityEntity { @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ViewEntityEntity that = (ViewEntityEntity) o; if (!className.equals(that.className)) return false; if (id != null ? !id.equals(that.id) : that.id != null) return false; if (idProperty != null ? !idProperty.equals(that.idProperty) : that.idProperty != null) return false; if (!viewInstanceName.equals(that.viewInstanceName)) return false; if (!viewName.equals(that.viewName)) return false; return true; }  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 testEquals() 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.assertTrue(viewEntityEntity.equals(viewEntityEntity2)); viewEntityEntity2.setId(100L); Assert.assertFalse(viewEntityEntity.equals(viewEntityEntity2)); }