### Question:
DataSourceResourceLoader extends HadoopClassLoader { static DataSourceResourceLoader create(@Nonnull final SparkContext sparkContext) { Handler.setConfiguration(sparkContext.hadoopConfiguration()); Handler.register(); final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); final ClassLoader parentClassLoader = (contextClassLoader != null) ? contextClassLoader : DataSourceResourceLoader.class.getClassLoader(); return new DataSourceResourceLoader(sparkContext, parentClassLoader); } DataSourceResourceLoader(@Nonnull final SparkContext sparkContext, @Nonnull final ClassLoader parent); void addFile(@Nullable final String path); @Nonnull Optional<DataSourceRegister> getDataSource(@Nonnull final String shortName); T runWithThreadContext(@Nonnull final Callable<T> callable); void runWithThreadContext(@Nonnull final Runnable runnable);  }### Answer:
@Test public void addJar() { final SparkContext sparkContext = Mockito.mock(SparkContext.class); Mockito.when(sparkContext.hadoopConfiguration()).thenReturn(new Configuration(false)); final DataSourceResourceLoader loader = DataSourceResourceLoader.create(sparkContext); final String jarUrl = getClass().getResource("./").toString(); loader.addJar(jarUrl.replace("file:", "local:")); Mockito.verify(sparkContext, Mockito.times(1)).addJar(jarUrl); Assert.assertNotNull(loader.getResource("DataSourceResourceLoaderTest.class")); }