@Test
public void testSkipLastTimed() {

    TestScheduler scheduler = new TestScheduler();
    PublishSubject<Integer> source = PublishSubject.create();
    Observable<Integer> result = source.skipLast(1, TimeUnit.SECONDS, scheduler);
    Observer<Object> o = mock(Observer.class);
    result.subscribe(o);
    source.onNext(1);
    source.onNext(2);
    source.onNext(3);
    scheduler.advanceTimeBy(500, TimeUnit.MILLISECONDS);
    source.onNext(4);
    source.onNext(5);
    source.onNext(6);
    scheduler.advanceTimeBy(950, TimeUnit.MILLISECONDS);
    source.onCompleted();
    InOrder inOrder = inOrder(o);
    inOrder.verify(o).onNext(1);
    inOrder.verify(o).onNext(2);
    inOrder.verify(o).onNext(3);
    inOrder.verify(o, never()).onNext(4);
    inOrder.verify(o, never()).onNext(5);
    inOrder.verify(o, never()).onNext(6);
    inOrder.verify(o).onCompleted();
    inOrder.verifyNoMoreInteractions();
    verify(o, never()).onError(any(Throwable.class));
}