void fetchRepositoryAndPackageMetaData(GoPluginDescriptor pluginDescriptor) {
        try {
            RepositoryConfiguration repositoryConfiguration = packageRepositoryExtension.getRepositoryConfiguration(pluginDescriptor.id());
            com.thoughtworks.go.plugin.api.material.packagerepository.PackageConfiguration packageConfiguration = packageRepositoryExtension.getPackageConfiguration(pluginDescriptor.id());
            if (repositoryConfiguration == null) {
                throw new RuntimeException(format("Plugin[%s] returned null repository configuration", pluginDescriptor.id()));
            }
            if (packageConfiguration == null) {
                throw new RuntimeException(format("Plugin[%s] returned null package configuration", pluginDescriptor.id()));
            }
            repositoryMetadataStore.addMetadataFor(pluginDescriptor.id(), new PackageConfigurations(repositoryConfiguration));
            packageMetadataStore.addMetadataFor(pluginDescriptor.id(), new PackageConfigurations(packageConfiguration));
        } catch (GoPluginFrameworkException e) {
            LOGGER.error("Failed to fetch package metadata for plugin : {}", pluginDescriptor.id(), e);
        }
    }
@Test
    public void shouldThrowExceptionWhenNullRepositoryConfigurationReturned() {
        when(packageRepositoryExtension.getRepositoryConfiguration(pluginDescriptor.id())).thenReturn(null);
        try {
            metadataLoader.fetchRepositoryAndPackageMetaData(pluginDescriptor);
        } catch (Exception e) {
            assertThat(e.getMessage(), is("Plugin[plugin-id] returned null repository configuration"));
        }
        assertThat(RepositoryMetadataStore.getInstance().getMetadata(pluginDescriptor.id()), nullValue());
        assertThat(PackageMetadataStore.getInstance().getMetadata(pluginDescriptor.id()), nullValue());
    }