ComponentDescriptorAddedEvent extends AbstractComponentDescriptorEvent { @Override public boolean matches(Object otherEvent) { boolean result = false; if (ComponentDescriptorAddedEvent.class.isAssignableFrom(otherEvent.getClass())) { result = super.matches(otherEvent); } return result; } ComponentDescriptorAddedEvent();  ComponentDescriptorAddedEvent(Class<?> role);  ComponentDescriptorAddedEvent(Type roleType);  ComponentDescriptorAddedEvent(Class<?> role, String roleHint);  ComponentDescriptorAddedEvent(Type roleType, String roleHint); @Override boolean matches(Object otherEvent);  }
@Test void matchesAllComponentRoles() { ComponentDescriptorAddedEvent event = new ComponentDescriptorAddedEvent(); assertTrue(event.matches(new ComponentDescriptorAddedEvent((Type) Dummy.class, "rolehint"))); }
@Test void matchesWhenDifferentEvent() { ComponentDescriptorAddedEvent event = new ComponentDescriptorAddedEvent(); assertFalse(event.matches((Event) e -> false)); }
@Test void matchesWhenSpecificRoleSpecified() { ComponentDescriptorAddedEvent event = new ComponentDescriptorAddedEvent((Type) Dummy.class); assertTrue(event.matches(new ComponentDescriptorAddedEvent((Type) Dummy.class, "rolehint"))); assertFalse(event.matches(new ComponentDescriptorAddedEvent((Type) ComponentDescriptorAddedEvent.class, "rolehint"))); }