use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event in project mvp4g2 by mvp4g.
the class StartEventTest method testStartEventTestEventBusWithOneStartAnnotation.
@Test
public void testStartEventTestEventBusWithOneStartAnnotation() {
Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {
{
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/startEventTestEventBusWithOneStartAnnotation/StartEventTestEventBusWithOneStartAnnotation.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/startEventTestEventBusWithOneStartAnnotation/MockShellPresenter.java"));
}
});
CompilationSubject.assertThat(compilation).succeeded();
JavaFileObjectSubject.assertThat(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/startEventTestEventBusWithOneStartAnnotation/StartEventTestEventBusWithOneStartAnnotationImpl.java")).hasSourceEquivalentTo(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/startEventTestEventBusWithOneStartAnnotation/StartEventTestEventBusWithOneStartAnnotationImpl.java"));
JavaFileObjectSubject.assertThat(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/startEventTestEventBusWithOneStartAnnotation/Com_github_mvp4g_mvp4g2_processor_event_startEventTestEventBusWithOneStartAnnotation_MockShellPresenterMetaData.java")).hasSourceEquivalentTo(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/startEventTestEventBusWithOneStartAnnotation/Com_github_mvp4g_mvp4g2_processor_event_startEventTestEventBusWithOneStartAnnotation_MockShellPresenterMetaData.java"));
JavaFileObjectSubject.assertThat(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/startEventTestEventBusWithOneStartAnnotation/Com_github_mvp4g_mvp4g2_processor_event_startEventTestEventBusWithOneStartAnnotation_StartEventTestEventBusWithOneStartAnnotation_start.java")).hasSourceEquivalentTo(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/startEventTestEventBusWithOneStartAnnotation/Com_github_mvp4g_mvp4g2_processor_event_startEventTestEventBusWithOneStartAnnotation_StartEventTestEventBusWithOneStartAnnotation_start.java"));
}
use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event in project mvp4g2 by mvp4g.
the class EventbusTest method testStartEventTestEventBusWithMoreThanOneStartAnnotation.
@Test
public void testStartEventTestEventBusWithMoreThanOneStartAnnotation() {
Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {
{
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/startEventTestEventBusWithMoreThanOneStartAnnotation/StartEventTestEventBusWithMoreThanOneStartAnnotation.java"));
}
});
CompilationSubject.assertThat(compilation).failed();
CompilationSubject.assertThat(compilation).hadErrorContaining("@Start-annotation can only be used a single time in a eventbus interface");
}
use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event in project mvp4g2 by mvp4g.
the class EventbusTest method testStartEventTestWithNonZeroArgumentMethod.
@Test
public void testStartEventTestWithNonZeroArgumentMethod() {
Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {
{
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/startEventTestWithNonZeroArgumentMethod/StartEventTestWithNonZeroArgumentMethod.java"));
}
});
CompilationSubject.assertThat(compilation).failed();
CompilationSubject.assertThat(compilation).hadErrorContaining("@Start-annotation can only be used on zero argument methods");
}
use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event 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.eventbus.annotation.Event in project mvp4g2 by mvp4g.
the class PresenterTest method testEventHandlerWithNotImplementedEvent.
@Test
public void testEventHandlerWithNotImplementedEvent() {
Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {
{
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/presenterWithNotImplementedEvent/EventBusEventHandlerWithNotImplementedEvent.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/presenterWithNotImplementedEvent/MockShellPresenter01.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/presenterWithNotImplementedEvent/IMockShellView01.java"));
add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/presenterWithNotImplementedEvent/MockShellView01.java"));
}
});
CompilationSubject.assertThat(compilation).failed();
CompilationSubject.assertThat(compilation).hadErrorContaining("event >>doSomething()<< is never handled by a presenter or handler");
}
Aggregations