Search in sources :

Example 1 with RxLogObservable

use of com.fernandocejas.frodo.annotation.RxLogObservable in project frodo by android10.

the class LoggableObservableFactoryTest method shouldCreateLogStreamObservable.

@Test
public void shouldCreateLogStreamObservable() {
    final RxLogObservable annotation = mock(RxLogObservable.class);
    given(annotation.value()).willReturn(RxLogObservable.Scope.STREAM);
    final LoggableObservable loggableObservable = observableFactory.create(annotation);
    assertThat(loggableObservable).isInstanceOf(LogStreamObservable.class);
}
Also used : RxLogObservable(com.fernandocejas.frodo.annotation.RxLogObservable) Test(org.junit.Test)

Example 2 with RxLogObservable

use of com.fernandocejas.frodo.annotation.RxLogObservable in project frodo by android10.

the class LoggableObservableFactoryTest method shouldCreateLogNothingObservable.

@Test
public void shouldCreateLogNothingObservable() {
    final RxLogObservable annotation = mock(RxLogObservable.class);
    given(annotation.value()).willReturn(RxLogObservable.Scope.NOTHING);
    final LoggableObservable loggableObservable = observableFactory.create(annotation);
    assertThat(loggableObservable).isInstanceOf(LogNothingObservable.class);
}
Also used : RxLogObservable(com.fernandocejas.frodo.annotation.RxLogObservable) Test(org.junit.Test)

Example 3 with RxLogObservable

use of com.fernandocejas.frodo.annotation.RxLogObservable in project frodo by android10.

the class LogObservable method methodAnnotatedWithRxLogObservable.

@Pointcut(METHOD)
public static boolean methodAnnotatedWithRxLogObservable(ProceedingJoinPoint joinPoint) {
    final FrodoProceedingJoinPoint frodoJoinPoint = new FrodoProceedingJoinPoint(joinPoint);
    final Annotation annotation = frodoJoinPoint.getAnnotation(RxLogObservable.class);
    return ((MethodSignature) joinPoint.getSignature()).getReturnType() == Observable.class && ((RxLogObservable) annotation).value() != RxLogObservable.Scope.NOTHING;
}
Also used : FrodoProceedingJoinPoint(com.fernandocejas.frodo.joinpoint.FrodoProceedingJoinPoint) MethodSignature(org.aspectj.lang.reflect.MethodSignature) RxLogObservable(com.fernandocejas.frodo.annotation.RxLogObservable) Annotation(java.lang.annotation.Annotation) FrodoObservable(com.fernandocejas.frodo.internal.observable.FrodoObservable) Observable(rx.Observable) RxLogObservable(com.fernandocejas.frodo.annotation.RxLogObservable) Pointcut(org.aspectj.lang.annotation.Pointcut)

Example 4 with RxLogObservable

use of com.fernandocejas.frodo.annotation.RxLogObservable in project frodo by android10.

the class LoggableObservableFactoryTest method shouldCreateLogEverythingObservable.

@Test
public void shouldCreateLogEverythingObservable() {
    final RxLogObservable annotation = mock(RxLogObservable.class);
    given(annotation.value()).willReturn(RxLogObservable.Scope.EVERYTHING);
    final LoggableObservable loggableObservable = observableFactory.create(annotation);
    assertThat(loggableObservable).isInstanceOf(LogEverythingObservable.class);
}
Also used : RxLogObservable(com.fernandocejas.frodo.annotation.RxLogObservable) Test(org.junit.Test)

Example 5 with RxLogObservable

use of com.fernandocejas.frodo.annotation.RxLogObservable in project frodo by android10.

the class LoggableObservableFactoryTest method shouldCreateLogSchedulersObservable.

@Test
public void shouldCreateLogSchedulersObservable() {
    final RxLogObservable annotation = mock(RxLogObservable.class);
    given(annotation.value()).willReturn(RxLogObservable.Scope.SCHEDULERS);
    final LoggableObservable loggableObservable = observableFactory.create(annotation);
    assertThat(loggableObservable).isInstanceOf(LogSchedulersObservable.class);
}
Also used : RxLogObservable(com.fernandocejas.frodo.annotation.RxLogObservable) Test(org.junit.Test)

Aggregations

RxLogObservable (com.fernandocejas.frodo.annotation.RxLogObservable)6 Test (org.junit.Test)5 FrodoObservable (com.fernandocejas.frodo.internal.observable.FrodoObservable)1 FrodoProceedingJoinPoint (com.fernandocejas.frodo.joinpoint.FrodoProceedingJoinPoint)1 Annotation (java.lang.annotation.Annotation)1 Pointcut (org.aspectj.lang.annotation.Pointcut)1 MethodSignature (org.aspectj.lang.reflect.MethodSignature)1 Observable (rx.Observable)1