@Test
void unregisterComponent() throws Exception
{

    EmbeddableComponentManager ecm = new EmbeddableComponentManager();
    DefaultComponentDescriptor<Role> d1 = new DefaultComponentDescriptor<>();
    d1.setRoleType(Role.class);
    d1.setImplementation(RoleImpl.class);
    ecm.registerComponent(d1);
    // Verify that the component is properly registered
    assertSame(RoleImpl.class, ecm.getInstance(Role.class).getClass());
    ecm.unregisterComponent(d1.getRoleType(), d1.getRoleHint());
    // Verify that the component is not registered anymore
    Throwable exception = assertThrows(ComponentLookupException.class, () -> {
        ecm.getInstance(d1.getRoleType());
    });
    // The exception message doesn't matter. All we need to know is that the component descriptor
    // doesn't exist anymore.
}