@Test
public void testMaxWithEmpty() {

    Observable<Integer> observable = max(Observable.<Integer> empty());
    @SuppressWarnings("unchecked")
    Observer<Integer> observer = (Observer<Integer>) mock(Observer.class);
    observable.subscribe(observer);
    InOrder inOrder = inOrder(observer);
    inOrder.verify(observer, times(1)).onError(
            isA(IllegalArgumentException.class));
    inOrder.verifyNoMoreInteractions();
}