@Test
public void testFilter() {

    Observable<String> w = Observable.from("one", "two", "three");
    Observable<String> observable = Observable.create(filter(w, new Func1<String, Boolean>() {
        @Override
        public Boolean call(String t1) {
            return t1.equals("two");
        }
    }));
    @SuppressWarnings("unchecked")
    Observer<String> observer = mock(Observer.class);
    observable.subscribe(observer);
    verify(observer, Mockito.never()).onNext("one");
    verify(observer, times(1)).onNext("two");
    verify(observer, Mockito.never()).onNext("three");
    verify(observer, Mockito.never()).onError(any(Throwable.class));
    verify(observer, times(1)).onCompleted();
}