Search in sources :

Example 1 with TestJoinPoint

use of com.fernandocejas.frodo.joinpoint.TestJoinPoint in project frodo by android10.

the class LogObservableTest method shouldNotWeaveAroundMethodReturningOtherTypeThanObservable.

@Test
public void shouldNotWeaveAroundMethodReturningOtherTypeThanObservable() {
    final TestJoinPoint joinPoint = new TestJoinPoint.Builder(this.getClass(), "toString").withReturnType(this.getClass()).build();
    final TestProceedingJoinPoint proceedingJoinPoint = new TestProceedingJoinPoint(joinPoint);
    assertThat(LogObservable.methodAnnotatedWithRxLogObservable(proceedingJoinPoint)).isFalse();
}
Also used : TestProceedingJoinPoint(com.fernandocejas.frodo.joinpoint.TestProceedingJoinPoint) TestJoinPoint(com.fernandocejas.frodo.joinpoint.TestJoinPoint) Test(org.junit.Test)

Example 2 with TestJoinPoint

use of com.fernandocejas.frodo.joinpoint.TestJoinPoint in project frodo by android10.

the class LogSubscriberTest method printOnNextMessageBeforeSubscriberOnNextExecutionWithEmptyValues.

@Test
public void printOnNextMessageBeforeSubscriberOnNextExecutionWithEmptyValues() {
    final TestJoinPoint joinPointTest = new TestJoinPoint.Builder(subscriber.getClass()).withParamTypes(String.class).withParamNames("param").withParamValues().build();
    logSubscriber.beforeOnNextExecution(joinPointTest);
    verify(counter).increment();
    verify(stopWatch).start();
    verify(messageManager).printSubscriberOnNext(eq(subscriber.getClass().getSimpleName()), anyObject(), anyString());
}
Also used : TestJoinPoint(com.fernandocejas.frodo.joinpoint.TestJoinPoint) Matchers.anyString(org.mockito.Matchers.anyString) Test(org.junit.Test)

Example 3 with TestJoinPoint

use of com.fernandocejas.frodo.joinpoint.TestJoinPoint in project frodo by android10.

the class LogSubscriberTest method shouldNotWeaveClassOfOtherTypeThanSubscriber.

@Test
public void shouldNotWeaveClassOfOtherTypeThanSubscriber() {
    final TestJoinPoint joinPoint = new TestJoinPoint.Builder(this.getClass()).build();
    final TestProceedingJoinPoint proceedingJoinPoint = new TestProceedingJoinPoint(joinPoint);
    assertThat(LogSubscriber.classAnnotatedWithRxLogSubscriber(proceedingJoinPoint)).isFalse();
}
Also used : TestProceedingJoinPoint(com.fernandocejas.frodo.joinpoint.TestProceedingJoinPoint) TestJoinPoint(com.fernandocejas.frodo.joinpoint.TestJoinPoint) Test(org.junit.Test)

Example 4 with TestJoinPoint

use of com.fernandocejas.frodo.joinpoint.TestJoinPoint in project frodo by android10.

the class ObservableInfoTest method setUp.

@Before
public void setUp() {
    final TestJoinPoint testJoinPoint = new TestJoinPoint.Builder(this.getClass()).withReturnType(Observable.class).withReturnValue(OBSERVABLE_STREAM_VALUE).build();
    final FrodoJoinPoint frodoJoinPoint = new FrodoJoinPoint(testJoinPoint);
    observableInfo = new ObservableInfo(frodoJoinPoint);
}
Also used : ObservableInfo(com.fernandocejas.frodo.internal.observable.ObservableInfo) FrodoJoinPoint(com.fernandocejas.frodo.joinpoint.FrodoJoinPoint) TestJoinPoint(com.fernandocejas.frodo.joinpoint.TestJoinPoint) Before(org.junit.Before)

Example 5 with TestJoinPoint

use of com.fernandocejas.frodo.joinpoint.TestJoinPoint in project frodo by android10.

the class ObservableRule method apply.

@Override
public Statement apply(Statement statement, Description description) {
    final TestJoinPoint testJoinPoint = new TestJoinPoint.Builder(declaringType).withReturnType(Observable.class).withReturnValue(OBSERVABLE_STREAM_VALUE).build();
    final TestProceedingJoinPoint testProceedingJoinPoint = new TestProceedingJoinPoint(testJoinPoint);
    frodoProceedingJoinPoint = new FrodoProceedingJoinPoint(testProceedingJoinPoint);
    observableInfo = new ObservableInfo(frodoProceedingJoinPoint);
    return statement;
}
Also used : TestProceedingJoinPoint(com.fernandocejas.frodo.joinpoint.TestProceedingJoinPoint) FrodoProceedingJoinPoint(com.fernandocejas.frodo.joinpoint.FrodoProceedingJoinPoint) TestJoinPoint(com.fernandocejas.frodo.joinpoint.TestJoinPoint)

Aggregations

TestJoinPoint (com.fernandocejas.frodo.joinpoint.TestJoinPoint)6 TestProceedingJoinPoint (com.fernandocejas.frodo.joinpoint.TestProceedingJoinPoint)4 Test (org.junit.Test)4 ObservableInfo (com.fernandocejas.frodo.internal.observable.ObservableInfo)1 FrodoJoinPoint (com.fernandocejas.frodo.joinpoint.FrodoJoinPoint)1 FrodoProceedingJoinPoint (com.fernandocejas.frodo.joinpoint.FrodoProceedingJoinPoint)1 Before (org.junit.Before)1 Matchers.anyString (org.mockito.Matchers.anyString)1