DefaultClassesScanner implements ClassesScanner { @Override public ScanResult scan(Path pluginFile, List<Class> extensionPoints) throws PluginException { try { Path unpackedPluginDirectory = PluginUtils.unpackPlugin(pluginFile, cacheDirectory); Path pluginImplementationDirectory = PluginUtils.getPluginImplementationDirectory(unpackedPluginDirectory); ClassLoader classLoader = getClassLoader(unpackedPluginDirectory, pluginImplementationDirectory); PluginImplementationsAware pluginImplementationsAware = PluginUtils.getMatchingClasses(extensionPoints, pluginImplementationDirectory, classLoader); return new DefaultScanResult(classLoader, pluginImplementationsAware); } catch (Exception e) { throw new PluginException(e); } } DefaultClassesScanner(Path cacheDirectory); @Override ScanResult scan(Path pluginFile, List<Class> extensionPoints);  }
@Test(expected = PluginException.class) public void testInvalidPluginCacheDirectory() throws PluginException, IOException { Path cacheDirectory = getCacheDirectory(); Path pluginCacheDirectory = getPluginCachePath(); Files.createDirectories(cacheDirectory); Files.createFile(pluginCacheDirectory); Path pluginFile = getPluginFilePath(); new DefaultClassesScanner(cacheDirectory).scan(pluginFile, new ArrayList<>()); }