use of org.ligoj.app.resource.plugin.PluginsClassLoader in project plugin-prov by ligoj.
the class TerraformResourceTest method toFile.
@Test
public void toFile() throws IOException {
ThreadClassLoaderScope scope = null;
try {
final PluginsClassLoader classLoader = Mockito.mock(PluginsClassLoader.class);
scope = new ThreadClassLoaderScope(new URLClassLoader(new URL[0], classLoader));
final File file = new File("");
final Subscription entity = new Subscription();
entity.setId(15);
Mockito.when(classLoader.toFile(entity, "15", "some")).thenReturn(file);
Assertions.assertSame(file, resource.toFile(entity, "some"));
Assertions.assertNotNull(PluginsClassLoader.getInstance());
} finally {
IOUtils.closeQuietly(scope);
}
}
Aggregations