@Test
public void testMaxByWithEmpty() {

    Observable<List<String>> observable = maxBy(
            Observable.<String> empty(), new Func1<String, Integer>() {
                @Override
                public Integer call(String t1) {
                    return Integer.parseInt(t1) % 2;
                }
            });
    @SuppressWarnings("unchecked")
    Observer<List<String>> observer = (Observer<List<String>>) mock(Observer.class);
    observable.subscribe(observer);
    InOrder inOrder = inOrder(observer);
    inOrder.verify(observer, times(1)).onNext(new ArrayList<String>());
    inOrder.verify(observer, times(1)).onCompleted();
    inOrder.verifyNoMoreInteractions();
}