### Question:
SeamBeanNameResolver implements ELBeanNameResolver { public boolean init(ServletContext servletContext, ClassLoader classLoader) { try { Class<?> seamClass = classLoader.loadClass(SEAM_CLASS); getComponentNameMethod = seamClass.getMethod(GET_COMPONENT_NAME_METHOD, Class.class); if (log.isDebugEnabled()) { log.debug("Seam environment detected. Enabling bean name resolving via Seam."); } return true; } catch (ClassNotFoundException e) { if (log.isDebugEnabled()) { log.debug("Seam class has not been found. Seam resolver will be disabled."); } } catch (NoSuchMethodException e) { log.warn("Cannot find method getComponentName() on Seam class.", e); } catch (SecurityException e) { log.warn("Unable to init resolver due to security restrictions", e); } return false; }  boolean init(ServletContext servletContext, ClassLoader classLoader); String getBeanName(Class<?> clazz);  }### Answer:
@Test public void testNoSeamEnvironment() throws Exception { ServletContext servletContext = EasyMock.createNiceMock(ServletContext.class); ClassLoader classLoader = EasyMock.createNiceMock(ClassLoader.class); EasyMock.expect(classLoader.loadClass((String) EasyMock.anyObject())).andThrow(new ClassNotFoundException()) .anyTimes(); EasyMock.replay(classLoader); SeamBeanNameResolver resolver = new SeamBeanNameResolver(); boolean initCompleted = resolver.init(servletContext, classLoader); assertFalse(initCompleted); }