### Question:
MultipleParentClassLoader extends InjectionClassLoader { protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { for (ClassLoader parent : parents) { try { Class<?> type = parent.loadClass(name); if (resolve) { resolveClass(type); } return type; } catch (ClassNotFoundException ignored) { } } return super.loadClass(name, resolve); } MultipleParentClassLoader(List<? extends ClassLoader> parents);  MultipleParentClassLoader(ClassLoader parent, List<? extends ClassLoader> parents);  MultipleParentClassLoader(ClassLoader parent, List<? extends ClassLoader> parents, boolean sealed); URL getResource(String name); Enumeration<URL> getResources(String name);  }### Answer:
@Test public void testMultipleParentClassLoading() throws Exception { ClassLoader classLoader = new MultipleParentClassLoader.Builder().append(first, second, null).build(); assertThat(classLoader.loadClass(FOO), CoreMatchers.<Class<?>>is(Foo.class)); assertThat(classLoader.loadClass(BAR), CoreMatchers.<Class<?>>is(BarFirst.class)); assertThat(classLoader.loadClass(QUX), CoreMatchers.<Class<?>>is(Qux.class)); verify(first).loadClass(FOO); verify(first).loadClass(BAR); verify(first).loadClass(QUX); verifyNoMoreInteractions(first); verify(second).loadClass(QUX); verifyNoMoreInteractions(second); }
@Test(expected = ClassNotFoundException.class) public void testMultipleParentClassLoadingNotFound() throws Exception { new MultipleParentClassLoader.Builder().append(first, second, null).build().loadClass(BAZ); }