### Question:
ProviderConverterFactoryImpl implements ProviderConverterFactory { @Override public ProviderConfigConverter getProviderConfigConverter(final ProviderTypeKey providerTypeKey) { final BackendProviderHandler handler = handlerRegistry.ensureHandler(providerTypeKey); return handler.getProviderConfigConverter(); } ProviderConverterFactoryImpl(); @Inject  ProviderConverterFactoryImpl(final BackendProviderHandlerRegistry handlerRegistry); @Override ProviderConfigConverter getProviderConfigConverter(final ProviderTypeKey providerTypeKey); @Override ProviderConverter getProviderConverter();  }### Answer:
@Test public void testGetProviderConfigConverterWhenHandlerConfigured() { when(handlerRegistry.ensureHandler(providerTypeKey)).thenReturn(providerHandler); when(providerHandler.getProviderConfigConverter()).thenReturn(configConverter); assertEquals(configConverter, converterFactory.getProviderConfigConverter(providerTypeKey)); }
@Test public void testGetProviderConfigConverterWhenHandlerNotConfigured() { when(handlerRegistry.ensureHandler(providerTypeKey)).thenThrow(new RuntimeException(ERROR_MESSAGE)); expectedException.expectMessage(ERROR_MESSAGE); converterFactory.getProviderConfigConverter(providerTypeKey); }