GetUsersDemoUseCase extends UseCase<List<UserDemoEntity>> { @Override public Observable<List<UserDemoEntity>> react() { return repository.askForUsers(); } @Inject  GetUsersDemoUseCase(UI ui, UserDemoRepository repository); @Override Observable<List<UserDemoEntity>> react();  }
@Test public void When_Execute_Get_Users() { when(userDemoRepositoryMock.askForUsers()).thenReturn(Observable.just(Arrays.asList())); TestSubscriber<List<UserDemoEntity>> subscriberMock = new TestSubscriber<>(); getUsersDemoUseCaseUT.react().subscribe(subscriberMock); subscriberMock.awaitTerminalEvent(); assertThat(subscriberMock.getOnCompletedEvents().size(), is(1)); }