ClassLoaderBeanFactory implements ExtensibleBeanFactory { public Object get(final String entityBeanKey) { final Class clazz = getClassFromMapping(entityBeanKey, mappingClasses, cacheClasses); if (clazz != null) { try { return clazz.newInstance(); } catch (Exception exp) { LOG.error("Unable to create instance for key = {}", entityBeanKey); LOG.error(exp.getMessage(), exp); } } return null; } ClassLoaderBeanFactory(final ClassLoader classLoader);  ClassLoaderBeanFactory(final ClassLoader classLoader,
                                  final Map<String, String> mappingClasses,
                                  final Map<String, String> mappingEntityRepresentatives); void registerDto(final String key, final String className); void registerEntity(final String key, final String className, final String representative); Class getClazz(final String entityBeanKey); Object get(final String entityBeanKey); void releaseResources();  }
@Test public void testGetNotFound() throws Exception { final ExtensibleBeanFactory fb = new ClassLoaderBeanFactory(ClassLoaderBeanFactoryTest.class.getClassLoader()); final Object myDtoInstance = fb.get("myDto"); assertNull(myDtoInstance); }
@Test public void testGetNull() throws Exception { final ExtensibleBeanFactory fb = new ClassLoaderBeanFactory(ClassLoaderBeanFactoryTest.class.getClassLoader()); final Object myDtoInstance = fb.get(null); assertNull(myDtoInstance); }
@Test public void testGetEmpty() throws Exception { final ExtensibleBeanFactory fb = new ClassLoaderBeanFactory(ClassLoaderBeanFactoryTest.class.getClassLoader()); final Object myDtoInstance = fb.get(""); assertNull(myDtoInstance); }