DefaultConfigRegistry implements ConfigRegistry { @Override public ConfigFactory getFactory(String namespace) { ConfigFactory config = m_instances.get(namespace); return config; }  @Override void register(String namespace, ConfigFactory factory); @Override ConfigFactory getFactory(String namespace);  }
@Test public void testGetFactory() throws Exception { String someNamespace = "someName"; ConfigFactory someConfigFactory = new MockConfigFactory(); defaultConfigRegistry.register(someNamespace, someConfigFactory); assertThat("Should return the registered config factory", defaultConfigRegistry.getFactory(someNamespace), equalTo(someConfigFactory)); }
@Test public void testGetFactoryWithNamespaceUnregistered() throws Exception { String someUnregisteredNamespace = "someName"; assertNull(defaultConfigRegistry.getFactory(someUnregisteredNamespace)); }