use of com.github.mvp4g.mvp4g2.core.ui.annotation.EventHandler in project mvp4g2 by mvp4g.
the class HandlerTest method testEventHandlerAnnotationAnnotatedAbstractClass.
@Test
public void testEventHandlerAnnotationAnnotatedAbstractClass() {
Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlerAnnotationAnnotatedOnAbstractClass/EventHandlerAnnotationAnnotatedOnAbstractClass.java"));
CompilationSubject.assertThat(compilation).failed();
CompilationSubject.assertThat(compilation).hadErrorContaining("@Handler can not be ABSTRACT");
}
use of com.github.mvp4g.mvp4g2.core.ui.annotation.EventHandler in project mvp4g2 by mvp4g.
the class HandlerTest method testEventHandlerOK.
@Test
public void testEventHandlerOK() {
Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {
{
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlerOK/EventHandlerOK.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlerOK/MockEventBus.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlerOK/MockShellPresenter.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlerOK/MockOneEventHandler.java"));
}
});
CompilationSubject.assertThat(compilation).succeeded();
JavaFileObjectSubject.assertThat(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlerOK/Com_github_mvp4g_mvp4g2_processor_eventhandler_eventHandlerOK_EventHandlerOKMetaData.java")).hasSourceEquivalentTo(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlerOK/Com_github_mvp4g_mvp4g2_processor_eventhandler_eventHandlerOK_EventHandlerOKMetaData.java"));
}
use of com.github.mvp4g.mvp4g2.core.ui.annotation.EventHandler in project mvp4g2 by mvp4g.
the class HandlerTest method testEventHandlingMethodDoesNotReturnVoid01.
@Test
public void testEventHandlingMethodDoesNotReturnVoid01() {
Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {
{
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid01/EventBusEventHandlingMethodDoesNotReturnVoid.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid01/MockOneEventHandler.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid01/MockShellPresenter01.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid01/IMockShellView01.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid01/MockShellView01.java"));
}
});
CompilationSubject.assertThat(compilation).failed();
CompilationSubject.assertThat(compilation).hadErrorContaining("Mvp4g2Processor: >>com.github.mvp4g.mvp4g2.processor.eventhandler.eventHandlingMethodDoesNotReturnVoid01.MockOneEventHandler<< -> EventElement: >>onDoSomethingInHandler(java.lang.String)<< must return 'void'");
}
use of com.github.mvp4g.mvp4g2.core.ui.annotation.EventHandler in project mvp4g2 by mvp4g.
the class HandlerTest method testHandlerWithWrongImplementation02.
@Test
public void testHandlerWithWrongImplementation02() {
Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {
{
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/handlerWithWrongImplementation02/EventBusHandlerWithNotImplementedEvent.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/handlerWithWrongImplementation02/MockOneEventHandler.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/handlerWithWrongImplementation02/MockShellPresenter01.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/handlerWithWrongImplementation02/IMockShellView01.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/handlerWithWrongImplementation02/MockShellView01.java"));
}
});
CompilationSubject.assertThat(compilation).failed();
CompilationSubject.assertThat(compilation).hadErrorContaining("event >>doSomethingInHandler()<< is never handled by a presenter or handler");
}
use of com.github.mvp4g.mvp4g2.core.ui.annotation.EventHandler in project mvp4g2 by mvp4g.
the class PresenterTest method testPresenterOK.
@Test
public void testPresenterOK() {
Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {
{
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/presenterOK/PresenterOK.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/presenterOK/MockEventBus.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/presenterOK/MockShellPresenter.java"));
}
});
CompilationSubject.assertThat(compilation).succeeded();
JavaFileObjectSubject.assertThat(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/presenterOK/Com_github_mvp4g_mvp4g2_processor_eventhandler_presenterOK_PresenterOKMetaData.java")).hasSourceEquivalentTo(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/presenterOK/Com_github_mvp4g_mvp4g2_processor_eventhandler_presenterOK_PresenterOKMetaData.java"));
}
Aggregations