コード例 #1
0
 @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);
   }
 }
コード例 #2
0
 @Test(dataProvider = "provider", expectedExceptions = NullPointerException.class)
 public void loaderGetResourceAsStream(ClassLoader cl) {
   cl.getResourceAsStream(null);
 }
コード例 #3
0
 @Test(dataProvider = "provider", expectedExceptions = NullPointerException.class)
 public static void loaderResources(ClassLoader cl) throws IOException {
   Stream<URL> retVal = cl.resources(null);
 }