### Question:
InMemoryRuntimeRegistry implements RuntimeRegistry { @Override public List<Provider> getProvidersByType(final ProviderType providerType) { checkNotNull("providerType", providerType); return providers.values().stream() .filter(provider -> providerType.equals(provider.getProviderType())) .collect(Collectors.toList()); } InMemoryRuntimeRegistry(); @Override void registerProviderType(final ProviderType providerType); @Override List<ProviderType> getProviderTypes(final Integer page,
                                               final Integer pageSize,
                                               final String sort,
                                               final boolean sortOrder); @Override void deregisterProviderType(final ProviderType providerType); @Override void registerProvider(final Provider provider); @Override List<Provider> getProviders(final Integer page,
                                       final Integer pageSize,
                                       final String sort,
                                       final boolean sortOrder); @Override List<Provider> getProvidersByType(final ProviderType providerType); @Override Provider getProvider(final String providerId); @Override void deregisterProvider(final Provider provider); @Override void deregisterProvider(final String providerId); @Override void registerRuntime(final Runtime runtime); @Override List<Runtime> getRuntimes(final Integer page,
                                     final Integer pageSize,
                                     final String sort,
                                     final boolean sortOrder); @Override Runtime getRuntimeById(final String runtimeId); @Override void deregisterRuntime(final RuntimeId runtimeId); @Override Optional<T> getProvider(final ProviderId providerId,
                                                        final Class<T> clazz);  }### Answer:
@Test public void testGetProvidersByType() { ProviderType providerType1 = mockProviderTypeSPI("ProviderType1"); ProviderType providerType2 = mockProviderTypeSPI("ProviderType2"); List<Provider> providers = mockProviderListSPI(providerType, "1", ELEMENTS_COUNT); List<Provider> providersForType1 = mockProviderListSPI(providerType1, "2", ELEMENTS_COUNT); List<Provider> providersForType2 = mockProviderListSPI(providerType2, ELEMENTS_COUNT); List<Provider> allProviders = new ArrayList<>(); allProviders.addAll(providers); allProviders.addAll(providersForType1); allProviders.addAll(providersForType2); allProviders.forEach(provider -> runtimeRegistry.registerProvider(provider)); List<Provider> result = runtimeRegistry.getProvidersByType(providerType); assertEquals(providers.size(), result.size()); for (Provider provider : providers) { assertTrue(result.contains(provider)); } }