class NewsViewModel extends BaseViewModel {

	public void createNewsPagedList() {
		if (newsPagedListLiveData.getValue() == null){
			execute(
			disposable -> pagingDataStatus.postValue(DataStatus.LOADING),
			newsUIPagedList -> {
				newsPagedListLiveData.postValue(newsUIPagedList);
				pagingDataStatus.setValue(DataStatus.SUCCESS);
			},
			throwable -> pagingDataStatus.postValue(DataStatus.ERROR),
			newsUseCase.getNewsPagedList()
			);
		}
	}

}

class NewsViewModelTest {

	@Rule
	public InstantTaskExecutorRule instantTaskExecutorRule;
	@Mock GetNewsUseCase<NewsUI> usecase;
	@Mock PagedList<NewsUI> pagedList;
	private NewsViewModel viewModel;

	@Test
	public void verify_create_paged_list_called_only_once_in_success() throws InterruptedException {

		when(usecase.getNewsPagedList()).thenReturn(Observable.just(pagedList));
		verify(usecase, times(0)).getNewsPagedList();
		viewModel.createNewsPagedList();
		verify(usecase, times(1)).getNewsPagedList();
		viewModel.createNewsPagedList();
		verify(usecase, times(1)).getNewsPagedList();
	}

}