Search in sources :

Example 31 with Mvp4g2Processor

use of com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor in project mvp4g2 by mvp4g.

the class PresenterTest 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/presenterWithWrongImplementation02/EventBusHandlerWithNotImplementedEvent.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/presenterWithWrongImplementation02/MockShellPresenter01.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/presenterWithWrongImplementation02/IMockShellView01.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/presenterWithWrongImplementation02/MockShellView01.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("event >>doSomething(java.lang.String)<< is never handled by a presenter or handler");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Example 32 with Mvp4g2Processor

use of com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor in project mvp4g2 by mvp4g.

the class PresenterTest method testEventHandlingMethodDoesNotReturnVoid03.

@Test
public void testEventHandlingMethodDoesNotReturnVoid03() {
    Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid03/EventBusEventHandlingMethodDoesNotReturnVoid.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid03/MockShellPresenter01.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid03/IMockShellView01.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid03/MockShellView01.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("Mvp4g2Processor: >>com.github.mvp4g.mvp4g2.processor.eventhandler.eventHandlingMethodDoesNotReturnVoid03.MockShellPresenter01<< -> EventElement: >>onDoSomething()<< must return 'void'");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Example 33 with Mvp4g2Processor

use of com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor in project mvp4g2 by mvp4g.

the class PresenterTest method testEventHandlingMethodDoesNotReturnVoid04.

@Test
public void testEventHandlingMethodDoesNotReturnVoid04() {
    Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid04/EventBusEventHandlingMethodDoesNotReturnVoid.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid04/MockShellPresenter01.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid04/IMockShellView01.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventhandler/eventHandlingMethodDoesNotReturnVoid04/MockShellView01.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("Mvp4g2Processor: >>com.github.mvp4g.mvp4g2.processor.eventhandler.eventHandlingMethodDoesNotReturnVoid04.MockShellPresenter01<< -> EventElement: >>onDoSomething()<< must return 'void'");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Example 34 with Mvp4g2Processor

use of com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor in project mvp4g2 by mvp4g.

the class HistoryTest method testHistoryAnnotationOnAClassWhichDoesNotExtendsIsHistoryConverter.

@Test
public void testHistoryAnnotationOnAClassWhichDoesNotExtendsIsHistoryConverter() {
    Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/history/historyAnnotationOnAClassWhichDoesNotExtendsIsHistoryConverter/HistoryAnnotationOnAClassWhichDoesNotExtendsIsHistoryConverter.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("a class annotated with @History must extend IsHistoryConverter.class!");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Example 35 with Mvp4g2Processor

use of com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor in project mvp4g2 by mvp4g.

the class ImplementationTest method testOnlyApplicationData.

@Test
public void testOnlyApplicationData() {
    Compilation compilation = javac().withProcessors(new Mvp4g2Processor()).compile(new ArrayList<JavaFileObject>() {

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/implementation/testOnlyApplicationData/ApplicationAnnotation.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("no EventBusMetaModel found! Did you forget to create an EventBus for mvp4g2 or forget to annotate the EventBus with @EventBus?");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Aggregations

Mvp4g2Processor (com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor)72 Compilation (com.google.testing.compile.Compilation)72 Test (org.junit.Test)72 JavaFileObject (javax.tools.JavaFileObject)69 ProcessorException (com.github.mvp4g.mvp4g2.processor.ProcessorException)5 TypeElement (javax.lang.model.element.TypeElement)5 Element (javax.lang.model.element.Element)3 ExecutableElement (javax.lang.model.element.ExecutableElement)3 ClassNameModel (com.github.mvp4g.mvp4g2.processor.model.intern.ClassNameModel)2 Event (com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event)1 InitHistory (com.github.mvp4g.mvp4g2.core.history.annotation.InitHistory)1 NotFoundHistory (com.github.mvp4g.mvp4g2.core.history.annotation.NotFoundHistory)1 AbstractPresenter (com.github.mvp4g.mvp4g2.core.ui.AbstractPresenter)1 IsShell (com.github.mvp4g.mvp4g2.core.ui.IsShell)1 IsViewCreator (com.github.mvp4g.mvp4g2.core.ui.IsViewCreator)1 Presenter (com.github.mvp4g.mvp4g2.core.ui.annotation.Presenter)1 ProcessorUtils (com.github.mvp4g.mvp4g2.processor.ProcessorUtils)1 EventBusMetaModel (com.github.mvp4g.mvp4g2.processor.model.EventBusMetaModel)1 EventMetaModel (com.github.mvp4g.mvp4g2.processor.model.EventMetaModel)1 HandlerMetaModel (com.github.mvp4g.mvp4g2.processor.model.HandlerMetaModel)1