Search in sources :

Example 1 with EventBus

use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.EventBus in project mvp4g2 by mvp4g.

the class DebugTest method testDebugAnnotationOnAMethod.

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

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventbus/debugAnnotationOnAMethod/DebugAnnotationOnAMethod.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("@Debug can only be used on a type (interface)");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Example 2 with EventBus

use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.EventBus in project mvp4g2 by mvp4g.

the class DebugTest method testDebugAnnotationOnAClass.

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

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventbus/debugAnnotationOnAClass/DebugAnnotationOnAClass.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("@Debug can only be used on a type (interface)");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Example 3 with EventBus

use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.EventBus in project mvp4g2 by mvp4g.

the class EventbusTest method testEventBusAnnotationOnAMethod.

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

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventbus/eventBusAnnotationOnAMethod/EventBusAnnotationOnAMethod.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("@Eventbus can only be used on a type (interface)");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Example 4 with EventBus

use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.EventBus 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");
}
Also used : JavaFileObject(javax.tools.JavaFileObject) Compilation(com.google.testing.compile.Compilation) Mvp4g2Processor(com.github.mvp4g.mvp4g2.processor.Mvp4g2Processor) Test(org.junit.Test)

Example 5 with EventBus

use of com.github.mvp4g.mvp4g2.core.eventbus.annotation.EventBus in project mvp4g2 by mvp4g.

the class EventbusTest method testEventBusAnnotationOnAClass.

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

        {
            add(JavaFileObjects.forResource("com/github/mvp4g/mvp4g2/processor/eventbus/eventBusAnnotationOnAClass/EventBusAnnotationOnAClass.java"));
        }
    });
    CompilationSubject.assertThat(compilation).failed();
    CompilationSubject.assertThat(compilation).hadErrorContaining("@Eventbus can only be used with an interface");
}
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)14 Compilation (com.google.testing.compile.Compilation)14 JavaFileObject (javax.tools.JavaFileObject)14 Test (org.junit.Test)14 TypeElement (javax.lang.model.element.TypeElement)5 ProcessorException (com.github.mvp4g.mvp4g2.processor.ProcessorException)4 Element (javax.lang.model.element.Element)4 ExecutableElement (javax.lang.model.element.ExecutableElement)2 Event (com.github.mvp4g.mvp4g2.core.eventbus.annotation.Event)1 EventBus (com.github.mvp4g.mvp4g2.core.eventbus.annotation.EventBus)1 Start (com.github.mvp4g.mvp4g2.core.eventbus.annotation.Start)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 EventBusMetaModel (com.github.mvp4g.mvp4g2.processor.model.EventBusMetaModel)1 EventMetaModel (com.github.mvp4g.mvp4g2.processor.model.EventMetaModel)1 ClassNameModel (com.github.mvp4g.mvp4g2.processor.model.intern.ClassNameModel)1