public void testLoadExtension() throws Exception {
File file = new File("src/test/resources/FooBarPlugin.jar");
assertTrue("example plugin jar does not exist", file.exists());
ExtensionPackage extensionPackage = new ExtensionPackage("foobar plugin", "foo.bar", true, new File[] { file });
assertFalse(extensionPackage.isLoaded());
ClasspathScanDescriptorProvider descriptorProvider = new ClasspathScanDescriptorProvider();
extensionPackage.loadExtension(descriptorProvider);
assertTrue(extensionPackage.isLoaded());
assertEquals(1, extensionPackage.getLoadedAnalyzers());
assertEquals(1, extensionPackage.getLoadedTransformers());
assertEquals(1, extensionPackage.getLoadedFilters());
assertEquals("[AnnotationBasedAnalyzerBeanDescriptor[foo.bar.analyzer.BazAnalyzer]]", descriptorProvider
.getAnalyzerBeanDescriptors().toString());
assertEquals("[AnnotationBasedTransformerBeanDescriptor[foo.bar.transformer.BazTransformer]]", descriptorProvider
.getTransformerBeanDescriptors().toString());