@Test
public void testSingleOrDefaultWithEmpty() {

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