use of org.hotswap.agent.config.PluginRegistry in project HotswapAgent by HotswapProjects.
the class PluginManagerTest method testInit.
@Test
public void testInit() throws Exception {
PluginManager pluginManager = PluginManager.getInstance();
context.checking(new Expectations() {
{
allowing(instrumentation).addTransformer(with(any(ClassFileTransformer.class)));
allowing(annotationScanner).scanPlugins(with(any(ClassLoader.class)), with(any(String.class)));
will(returnValue(Collections.singletonList(SimplePlugin.class.getName())));
allowing(annotationProcessor).processAnnotations(with(any(Class.class)), with(any(Class.class)));
will(returnValue(true));
}
});
PluginRegistry pluginRegistry = pluginManager.getPluginRegistry();
pluginRegistry.setAnnotationScanner(annotationScanner);
pluginRegistry.setAnnotationProcessor(annotationProcessor);
pluginManager.init(instrumentation);
assertEquals("Plugin registered", pluginRegistry.getRegisteredPlugins().size(), 1);
assertTrue("Plugin correct class", pluginRegistry.getRegisteredPlugins().keySet().iterator().next().equals(SimplePlugin.class));
}
Aggregations