DefaultComponentDescriptor extends DefaultComponentRole<T> implements ComponentDescriptor<T> { @Override public boolean equals(Object object) { boolean result; if (this == object) { result = true; } else { if ((object == null) || (object.getClass() != this.getClass())) { result = false; } else { ComponentDescriptor cd = (ComponentDescriptor) object; result = super.equals(cd) && Objects.equals(getImplementation(), cd.getImplementation()) && Objects.equals(getInstantiationStrategy(), cd.getInstantiationStrategy()) && Objects.equals(getComponentDependencies(), cd.getComponentDependencies()); } } return result; } DefaultComponentDescriptor();  DefaultComponentDescriptor(ComponentDescriptor<T> descriptor); void setImplementation(Class<? extends T> implementation); @Override Class<? extends T> getImplementation(); void setInstantiationStrategy(ComponentInstantiationStrategy instantiationStrategy); @Override ComponentInstantiationStrategy getInstantiationStrategy(); @Override Collection<ComponentDependency<?>> getComponentDependencies(); void addComponentDependency(ComponentDependency<?> componentDependency); void addComponentDependency(Class<D> role, String roleHint); @Override String toString(); @Override boolean equals(Object object); @Override int hashCode();  }
@Test void equals() { DefaultComponentDescriptor cd1 = new DefaultComponentDescriptor(); cd1.setImplementation(ImplRole.class); cd1.setRoleType(Role.class); cd1.setRoleHint("hint"); assertEquals(cd1, cd1); DefaultComponentDescriptor cd2 = new DefaultComponentDescriptor(); cd2.setImplementation(ImplRole.class); cd2.setRoleType(Role.class); cd2.setRoleHint("hint"); assertEquals(cd1, cd2); DefaultComponentDescriptor cd3 = new DefaultComponentDescriptor(); cd3.setImplementation(ImplRole.class); cd3.setRoleType(OtherRole.class); cd3.setRoleHint("hint"); assertNotEquals(cd1, cd3); DefaultComponentDescriptor cd4 = new DefaultComponentDescriptor(); cd4.setImplementation(ImplOtherRole.class); cd4.setRoleType(Role.class); cd4.setRoleHint("hint"); assertNotEquals(cd1, cd4); DefaultComponentDescriptor cd5 = new DefaultComponentDescriptor(); cd5.setImplementation(ImplRole.class); cd5.setRoleType(Role.class); cd5.setRoleHint("hint"); cd5.setInstantiationStrategy(ComponentInstantiationStrategy.PER_LOOKUP); assertNotEquals(cd1, cd5); DefaultComponentDescriptor cd6 = new DefaultComponentDescriptor(); cd6.setImplementation(ImplRole.class); cd6.setRoleType(Role.class); cd6.setRoleHint("hint"); DefaultComponentDependency dep = new DefaultComponentDependency(); dep.setName("name"); dep.setRoleType(String.class); cd6.addComponentDependency(dep); assertNotEquals(cd1, cd6); DefaultComponentDescriptor cd7 = new DefaultComponentDescriptor(); cd7.setImplementation(ImplRole.class); cd7.setRoleType(Role.class); cd7.setRoleHint("hint"); DefaultComponentDependency dep2 = new DefaultComponentDependency(); dep2.setName("name"); dep2.setRoleType(String.class); cd7.addComponentDependency(dep2); assertEquals(cd6, cd7); DefaultComponentDescriptor cd8 = new DefaultComponentDescriptor(); cd8.setImplementation(ImplRole.class); cd8.setRoleType(Role.class); cd8.setRoleHint("hint"); DefaultComponentDependency dep3 = new DefaultComponentDependency(); dep3.setName("name"); dep3.setRoleType(String.class); cd8.addComponentDependency(dep3); cd8.addComponentDependency(dep3); assertNotEquals(cd7, cd8); DefaultComponentDescriptor cd9 = new DefaultComponentDescriptor(); cd9.setImplementation(ImplRole.class); cd9.setRoleType(Role.class); cd9.setRoleHint("hint"); DefaultComponentDependency dep4 = new DefaultComponentDependency(); dep4.setName("name2"); dep4.setRoleType(String.class); cd9.addComponentDependency(dep4); assertNotEquals(cd6, cd9); }