@Test
public void testInterval() {

    Observable<Long> w = Observable.create(OperationInterval.interval(1, TimeUnit.SECONDS, scheduler));
    Subscription sub = w.subscribe(observer);
    verify(observer, never()).onNext(0L);
    verify(observer, never()).onCompleted();
    verify(observer, never()).onError(any(Throwable.class));
    scheduler.advanceTimeTo(2, TimeUnit.SECONDS);
    InOrder inOrder = inOrder(observer);
    inOrder.verify(observer, times(1)).onNext(0L);
    inOrder.verify(observer, times(1)).onNext(1L);
    inOrder.verify(observer, never()).onNext(2L);
    verify(observer, never()).onCompleted();
    verify(observer, never()).onError(any(Throwable.class));
    sub.unsubscribe();
    scheduler.advanceTimeTo(4, TimeUnit.SECONDS);
    verify(observer, never()).onNext(2L);
    verify(observer, never()).onCompleted();
    verify(observer, never()).onError(any(Throwable.class));
}