@Test
    void verifyFindById() {
        val component = mock(ServiceRegistry.class);
        val service = mock(RegisteredService.class);
        when(component.findServiceById(anyLong())).thenReturn(service);
        when(component.findServiceById(anyLong(), any())).thenCallRealMethod();
        assertThrows(ClassCastException.class,
            () -> component.findServiceById(1, BaseMockRegisteredService.class));
    }
This is {@link ServiceRegistryTests}.

@author Misagh Moayyed
@since 6.3.0
api/cas-server-core-api-services/src/test/java/org/apereo/cas/services/ServiceRegistryTests.java