use of org.hotswap.agent.annotation.handler.AnnotationProcessor in project HotswapAgent by HotswapProjects.
the class AnnotationProcessorTest method testProcess.
@Test
public void testProcess() throws Exception {
context.checking(new Expectations() {
{
allowing(pluginManager).getHotswapTransformer();
will(returnValue(hotswapTransformer));
// two @Init annotations in SimplePlugin
exactly(2).of(initHandler).initMethod(with(any(PluginAnnotation.class)));
will(returnValue(true));
// @OnClassLoadEvent
exactly(1).of(onClassLoadedHandler).initMethod(with(any(PluginAnnotation.class)));
will(returnValue(true));
// Not satisfied, because invoked via reflection
// oneOf(simplePlugin).initPlugin();
// oneOf(simplePlugin).initPlugin(pluginManager);
}
});
final AnnotationProcessor annotationProcessor = new AnnotationProcessor(pluginManager);
annotationProcessor.addAnnotationHandler(Init.class, initHandler);
annotationProcessor.addAnnotationHandler(OnClassLoadEvent.class, onClassLoadedHandler);
annotationProcessor.processAnnotations(new SimplePlugin());
context.assertIsSatisfied();
}
Aggregations