@Override public Repository getRepository() {
    try {
      // NOTE: this class formerly used a ranking system to prioritize the providers registered and would check them in order
      // of priority for the first non-null repository.  In practice, we only ever registered one at a time, spoon or PUC.
      // As such, the priority ranking is gone and will need to be reintroduced if desired later.
      Collection<KettleRepositoryProvider> repositoryProviders = PluginServiceLoader.loadServices( KettleRepositoryProvider.class );
      return repositoryProviders.stream().map( KettleRepositoryProvider::getRepository ).filter( Objects::nonNull ).findFirst().orElse( null );
    } catch ( KettlePluginException e ) {
      logger.error( "Error getting repository", e );
    }
    return null;
  }
@Test
  public void testGetRepositoryMultiple() {
    KettleRepositoryProvider provider1 = mock( KettleRepositoryProvider.class );
    KettleRepositoryProvider provider2 = mock( KettleRepositoryProvider.class );
    KettleRepositoryProvider provider3 = mock( KettleRepositoryProvider.class );
    KettleRepositoryProvider provider4 = mock( KettleRepositoryProvider.class );
    Collection<KettleRepositoryProvider> providerCollection = new ArrayList<>();
    providerCollection.add( provider1 );
    providerCollection.add( provider2 );
    providerCollection.add( provider3 );
    providerCollection.add( provider4 );

    Repository repository = mock( Repository.class );
    when( repository.getName() ).thenReturn( "repo1" );
    Repository repository2 = mock( Repository.class );
    when( repository2.getName() ).thenReturn( "repo2" );
    when( provider1.getRepository() ).thenReturn( repository );
    when( provider2.getRepository() ).thenReturn( repository2 );
    Repository repository3 = mock( Repository.class );
    when( repository3.getName() ).thenReturn( "repo3" );
    when( provider3.getRepository() ).thenReturn( repository3 );
    Repository repository4 = mock( Repository.class );
    when( repository4.getName() ).thenReturn( "repo4" );
    when( provider4.getRepository() ).thenReturn( repository4 );

    // this test is a bit ugly and fairly dependent on the implementation of the collection being used here and
    // the Java streams implementation
    try ( MockedStatic<PluginServiceLoader> pluginServiceLoaderMockedStatic = Mockito.mockStatic( PluginServiceLoader.class ) ) {
      pluginServiceLoaderMockedStatic.when( () -> PluginServiceLoader.loadServices( any() ) ).thenReturn( providerCollection );
      Repository repoReturned = kettleRepositoryLocator.getRepository();
      assertEquals( "Expected repo1 got " + repoReturned.getName(), repository, repoReturned );
      verify( provider1 ).getRepository();
      verify( provider2, never() ).getRepository();
      verify( provider3, never() ).getRepository();
      verify( provider4, never() ).getRepository();
    }
  }