Feature { @Override public boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Feature feature = (Feature) o; return index == feature.index && Objects.equals(name, feature.name); } Feature(final String name, final String description, final String uri, final int index); String getName(); String getDescription(); String getUri(); int getIndex(); @Override String toString(); @Override boolean equals(final Object o); @Override int hashCode();  }
@Test public void equalsSameNameTest() { final Feature featureToCompare = new Feature("myFeature", "description", "uri", 2); assertThat(feature.equals(featureToCompare), is(false)); }
@Test public void equalsSameIndexTest() { final Feature featureToCompare = new Feature("otherName", "description", "uri", 1); assertThat(feature.equals(featureToCompare), is(false)); }
@Test public void equalsDifferentNameAndIndexTest() { final Feature featureToCompare = new Feature("otherName", "", "", 2); assertThat(feature.equals(featureToCompare), is(false)); }
@Test public void equalsSameNameAndIndexTest() { final Feature featureToCompare = new Feature("myFeature", "description", "uri", 1); assertThat(feature.equals(featureToCompare), is(true)); }