@Test
public void addJar() {

    // Mock Spark Context
    final SparkContext sparkContext = Mockito.mock(SparkContext.class);
    Mockito.when(sparkContext.hadoopConfiguration()).thenReturn(new Configuration(false));
    // Test adding local:/ jar
    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"));
}