@Test
    void verifyPullFails() throws Throwable {
        val gitRepository = mock(GitRepository.class);
        when(gitRepository.getObjectsInRepository()).thenThrow(new JGitInternalException("error"));
        when(gitRepository.getObjectsInRepository(any())).thenThrow(new JGitInternalException("error"));
        when(gitRepository.getRepositoryDirectory()).thenReturn(gitRepositoryInstance.getRepositoryDirectory());

        val svc = buildRegisteredServiceInstance(RandomUtils.nextLong(), CasRegisteredService.class);
        svc.setId(RegisteredServiceDefinition.INITIAL_IDENTIFIER_VALUE);
        newServiceRegistry.save(svc);
        val size = newServiceRegistry.load().size();

        val registry = new GitServiceRegistry(applicationContext, gitRepository,
            CollectionUtils.wrapList(
                new RegisteredServiceJsonSerializer(applicationContext),
                new RegisteredServiceYamlSerializer(applicationContext)),
            false, null, List.of(), List.of());
        assertEquals(size, registry.load().size());
    }
This is {@link GitServiceRegistryTests}.

@author Misagh Moayyed
@since 6.1.0
support/cas-server-support-git-service-registry/src/test/java/org/apereo/cas/services/GitServiceRegistryTests.java