@Test
    void verifyFindByName() {
        val component = mock(ServicesManager.class);

        when(component.findServiceByName(anyString())).thenReturn(null);
        when(component.findServiceByName(anyString(), any())).thenCallRealMethod();
        assertNull(component.findServiceByName("test", BaseMockRegisteredService.class));

        val service = mock(RegisteredService.class);
        when(component.findServiceByName(anyString())).thenReturn(service);
        assertNotNull(component.findServiceByName("test", RegisteredService.class));
    }
This is {@link ServicesManagerTests}.

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