### Question:
StandardProviderFactory implements ProviderFactory, DisposableBean { @PostConstruct @Override public synchronized void initialize() throws ProviderFactoryException { if (providersHolder.get() == null) { final File providersConfigFile = properties.getProvidersConfigurationFile(); if (providersConfigFile.exists()) { try { final SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI); final Schema schema = schemaFactory.newSchema(StandardProviderFactory.class.getResource(PROVIDERS_XSD)); final Unmarshaller unmarshaller = JAXB_CONTEXT.createUnmarshaller(); unmarshaller.setSchema(schema); final JAXBElement<Providers> element = unmarshaller.unmarshal(new StreamSource(providersConfigFile), Providers.class); providersHolder.set(element.getValue()); } catch (SAXException | JAXBException e) { LOGGER.error(e.getMessage(), e); throw new ProviderFactoryException("Unable to load the providers configuration file at: " + providersConfigFile.getAbsolutePath(), e); } } else { throw new ProviderFactoryException("Unable to find the providers configuration file at " + providersConfigFile.getAbsolutePath()); } } } @Autowired  StandardProviderFactory(final NiFiRegistryProperties properties, final ExtensionManager extensionManager, final DataSource dataSource); @PostConstruct @Override synchronized void initialize(); @Bean @Override synchronized FlowPersistenceProvider getFlowPersistenceProvider(); @Bean @Override List<EventHookProvider> getEventHookProviders(); @Bean @Override synchronized BundlePersistenceProvider getBundlePersistenceProvider(); @Override void destroy();  }### Answer:
@Test(expected = ProviderFactoryException.class) public void testProvidersConfigDoesNotExist() { final NiFiRegistryProperties props = new NiFiRegistryProperties(); props.setProperty(NiFiRegistryProperties.PROVIDERS_CONFIGURATION_FILE, "src/test/resources/provider/providers-does-not-exist.xml"); final ExtensionManager extensionManager = Mockito.mock(ExtensionManager.class); when(extensionManager.getExtensionClassLoader(any(String.class))) .thenReturn(new ExtensionClassLoader("/tmp", new URL[0],this.getClass().getClassLoader())); final DataSource dataSource = Mockito.mock(DataSource.class); final ProviderFactory providerFactory = new StandardProviderFactory(props, extensionManager, dataSource); providerFactory.initialize(); }