}
@SuppressWarnings("unchecked")
private JMethod newMethod(String name, JType[] params, Class[] events) {
EventHandler eventHandler = mock(EventHandler.class);
when(eventHandler.handles()).thenReturn(events);
JMethod method = mock(JMethod.class);
when(method.getAnnotation(EventHandler.class)).thenReturn(eventHandler);
when(method.getName()).thenReturn(name);
when(method.getParameterTypes()).thenReturn(params);