### Question:
KModuleBeanFactoryPostProcessor implements BeanFactoryPostProcessor, ApplicationContextAware { URL tryGetRootUrlForEapContext(Enumeration<URL> rootUrls) { boolean containsEapSpecificUrl = false; boolean containsWebInfClassesUrl = false; URL webInfClassesUrl = null; while (rootUrls.hasMoreElements()) { URL url = rootUrls.nextElement(); if (isEapSpecificUrl(url)) { containsEapSpecificUrl = true; } else if (url.toString().endsWith(WEB_INF_CLASSES_URL_SUFFIX)) { containsWebInfClassesUrl = true; webInfClassesUrl = url; } } if (containsEapSpecificUrl && containsWebInfClassesUrl) { return webInfClassesUrl; } else { return null; } } KModuleBeanFactoryPostProcessor();  KModuleBeanFactoryPostProcessor(URL kModuleRootUrl, ApplicationContext context);  KModuleBeanFactoryPostProcessor(URL kModuleRootUrl); URL getkModuleRootUrl(); void setReleaseId(ReleaseId releaseId); @Override void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory); @Override void setApplicationContext(ApplicationContext applicationContext);  }### Answer:
@Test public void testTryGetRootUrlForEapContext() throws Exception { final URL webInfClassesUrl = new URL("file: Enumeration<URL> urls = new Enumeration<URL>() { private int index = 0; @Override public boolean hasMoreElements() { return index <= 1; } @Override public URL nextElement() { try { if (index == 0) { index++; return webInfClassesUrl; } else if (index == 1) { index++; return new URL("file: } else { throw new IllegalStateException(""); } } catch (MalformedURLException e) { throw new RuntimeException("Buggy test!", e); } } }; KModuleBeanFactoryPostProcessor postProcessor = new KModuleBeanFactoryPostProcessor(); URL actualUrl = postProcessor.tryGetRootUrlForEapContext(urls); Assertions.assertThat(actualUrl).as("KModule root URL should have been found inside enumeration " + urls + "!").isEqualTo(webInfClassesUrl); }