### Question:
FactoryFinder { public void registerProviderFactory(String scheme, T factory) { cachedFactories.put(scheme, factory); } FactoryFinder(Class<T> factoryType, String path); static ObjectFactory getObjectFactory(); static void setObjectFactory(ObjectFactory objectFactory); T newInstance(String key); void registerProviderFactory(String scheme, T factory);  }### Answer:
@Test public void testRegisterProviderFactory() throws Exception { FactoryFinder<TestFactory> factory = new FactoryFinder<TestFactory>(TestFactory.class, TEST_LOCATOR_PATH); factory.registerProviderFactory("bar", new TestFactoryReturnsBAR()); TestFactory barFactory = factory.newInstance("bar"); assertNotNull(barFactory); assertTrue(barFactory instanceof TestFactoryReturnsBAR); }