### Question:
CustomPageChildFirstClassLoader extends MonoParentJarFileClassLoader implements VersionedClassloader { public void addCustomPageResources() throws IOException { addBDMDependencies(); addOtherDependencies(); } CustomPageChildFirstClassLoader(String pageName,
            CustomPageDependenciesResolver customPageDependenciesResolver,
            BDMClientDependenciesResolver bdmDependenciesResolver,
            ClassLoader parent); void addCustomPageResources(); @Override InputStream getResourceAsStream(final String name); void release(); @Override String toString(); @Override String getVersion(); @Override boolean hasVersion(String version);  }### Answer:
@Test public void should_add_custom_page_jar_resources_in_classloader_urls() throws Exception { classLoader = newClassloader(); when(customPageDependenciesResolver.resolveCustomPageDependencies()).thenReturn(loadedResources("util.jar")); classLoader.addCustomPageResources(); assertThat(classLoader.getURLs()).hasSize(1); }
@Test public void should_not_add_duplicated_bdm_dependencies_in_lib_folder_in_classloader() throws Exception { classLoader = newClassloader(); when(customPageDependenciesResolver.resolveCustomPageDependencies()) .thenReturn(loadedResources("util.jar", "bdm-model.jar", "bdm-dao.jar", "javassist-3.18.1-GA.jar")); when(bdmDependenciesResolver.isABDMDependency("bdm-model.jar")).thenReturn(true); when(bdmDependenciesResolver.isABDMDependency("bdm-dao.jar")).thenReturn(true); when(bdmDependenciesResolver.isABDMDependency("javassist-3.18.1-GA.jar")).thenReturn(true); classLoader.addCustomPageResources(); assertThat(classLoader.getURLs()).hasSize(1); }
@Test public void should__add_bdm_dependencies_in_classloader_before_other_dependencies() throws Exception { classLoader = spy(newClassloader()); final URL[] bdmDependenciesURLs = bdmDependenciesURLs(); when(bdmDependenciesResolver.getBDMDependencies()).thenReturn(bdmDependenciesURLs); when(customPageDependenciesResolver.resolveCustomPageDependencies()) .thenReturn(loadedResources("util.jar")); when(bdmDependenciesResolver.isABDMDependency("bdm-model.jar")).thenReturn(true); when(bdmDependenciesResolver.isABDMDependency("bdm-dao.jar")).thenReturn(true); when(bdmDependenciesResolver.isABDMDependency("javassist-3.18.1-GA.jar")).thenReturn(true); classLoader.addCustomPageResources(); final InOrder order = inOrder(classLoader,customPageDependenciesResolver); order.verify(classLoader).addURLs(bdmDependenciesURLs); order.verify(customPageDependenciesResolver).resolveCustomPageDependencies(); assertThat(classLoader.getURLs()).hasSize(4); }