### Question:
MongoDbWidget extends WidgetImpl { @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Widget)) return false; Widget that = (Widget) o; if (this.getId() != null ? !this.getId().equals(that.getId()) : that.getId() != null) return false; return true; } MongoDbWidget();  MongoDbWidget(String id); List<String> getCategoryIds(); void setCategoryIds(List<String> categoryIds); CategoryRepository getCategoryRepository(); void setCategoryRepository(CategoryRepository categoryRepository); @Override List<Category> getCategories(); @Override boolean equals(Object o); @Override int hashCode();  }### Answer:
@Test public void equals_Same(){ assertTrue(widget.equals(widget)); }
@Test public void equals_Not_Same_Instance(){ Object o = new Object(); assertFalse(widget.equals(o)); }
@Test public void equals_Null_Id(){ widget.setId(ID_1); Widget r = new MongoDbWidget(); assertFalse(widget.equals(r)); assertFalse(r.equals(widget)); }
@Test public void equals_Valid(){ widget.setId(ID_1); Widget r = new MongoDbWidget(); ((MongoDbWidget)r).setId(ID_1); assertTrue(widget.equals(r)); }
@Test public void equals_Null(){ widget.setId(null); Widget r = new MongoDbWidget(); ((MongoDbWidget)r).setId(null); assertTrue(widget.equals(r)); }