@DataProvider public static ClassLoader[][] provider() { try { return new ClassLoader[][] { {ClassLoader.getSystemClassLoader()}, {new MyClassLoader()}, { new URLClassLoader( new URL[] {Paths.get(".").toUri().toURL()}, ClassLoader.getSystemClassLoader()) } }; } catch (MalformedURLException e) { throw new RuntimeException(e); } }
@Test(dataProvider = "provider", expectedExceptions = NullPointerException.class) public void loaderGetResourceAsStream(ClassLoader cl) { cl.getResourceAsStream(null); }
@Test(dataProvider = "provider", expectedExceptions = NullPointerException.class) public static void loaderResources(ClassLoader cl) throws IOException { Stream<URL> retVal = cl.resources(null); }