Search in sources :

Example 46 with Mvp4g2Processor

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

the class EventTest method testEventBusWithOneNotFoundHistoryAnnotationAndNonZeroArgmentsSignature.

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

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventBusWithOneNotFoundHistoryAnnotationAndNonZeroArgmentsSignature/EventBusWithOneNotFoundHistoryAnnotationAndNonZeroArgmentsSignature.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventBusWithOneNotFoundHistoryAnnotationAndNonZeroArgmentsSignature/MockShellPresenter.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("@NotFoundHistory can only be used on a method with no arguments");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Example 47 with Mvp4g2Processor

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

the class EventTest method testEventTestHandlerInBindAndHandlersAttribute02.

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

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerInBindAndHandlersAttribute02/EventTestHandlerInBindAndHandlersAttribute.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestHandlerInBindAndHandlersAttribute02/MockShellPresenter.java"));
        }
    });
    CompilationSubject.assertThat(compilation).succeeded();
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Example 48 with Mvp4g2Processor

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

the class EventTest method testEventBusWithMoreThanOnNotFoundHistoryAnnodation.

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

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventBusWithMoreThanOnNotFoundHistoryAnnodation/EventBusWithMoreThanOnNotFoundHistoryAnnodation.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventBusWithMoreThanOnNotFoundHistoryAnnodation/MockShellPresenter.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("@NotFoundHistory can only be set a single time inside a event bus");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Example 49 with Mvp4g2Processor

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

the class EventTest method testEventTestPasiveEventWithBindAttribute.

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

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventTestPasiveEventWithBindAttribute/EventTestPasiveEventWithBindAttribute.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("a passive event can not have a bind-attribute");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Example 50 with Mvp4g2Processor

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

the class EventTest method testEventBusWithMoreThanOneInitHistoryAnnodation.

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

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventBusWithMoreThanOneInitHistoryAnnodation/EventBusWithMoreThanOneInitHistoryAnnodation.java"));
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/event/eventBusWithMoreThanOneInitHistoryAnnodation/MockShellPresenter.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("@InitHistory can only be set a single time inside a event bus");
}
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