@Test
public void fetchAllMovies_IOExceptionThenSuccess_fetchMoviesRetried() {

    //Given
    when(mMovieDbRestService.fetchAllMovies(anyString()))
            .thenReturn(getIOExceptionError(), Observable.just(moviesList()));
    //When
    TestSubscriber<List<Movie>> testSubscriber = new TestSubscriber<>();
    mMovieRepository.fetchMovies(POPULAR).subscribe(testSubscriber);
    //Then
    testSubscriber.awaitTerminalEvent();
    testSubscriber.assertNoErrors();
    verify(mMovieDbRestService, times(2)).fetchAllMovies(POPULAR);
}