@Test
public void testTimed() {

    final List<String> list = new ArrayList<String>();
    final List<List<String>> lists = new ArrayList<List<String>>();
    Observable<String> source = Observable.create(new Observable.OnSubscribeFunc<String>() {
        @Override
        public Subscription onSubscribe(Observer<? super String> observer) {
            push(observer, "one", 98);
            push(observer, "two", 99);
            push(observer, "three", 100);
            push(observer, "four", 101);
            push(observer, "five", 102);
            complete(observer, 150);
            return Subscriptions.empty();
        }
    });
    Observable<Observable<String>> windowed = Observable.create(window(source, 100, TimeUnit.MILLISECONDS, scheduler));
    windowed.subscribe(observeWindow(list, lists));
    scheduler.advanceTimeTo(101, TimeUnit.MILLISECONDS);
    assertEquals(1, lists.size());
    assertEquals(lists.get(0), list("one", "two", "three"));
    scheduler.advanceTimeTo(201, TimeUnit.MILLISECONDS);
    assertEquals(2, lists.size());
    assertEquals(lists.get(1), list("four", "five"));
}