@Test public void loadData() { apiViewModel.getData(); when(repository.getData()).thenReturn(mock(LiveData.class)); verify(repository).getData(); }
@VisibleForTesting public LiveData<Resource<Example>> getData() { data =apiRepository.getData(); return data; }
ApiViewModel extends ViewModel { @VisibleForTesting public LiveData<Resource<Example>> getData() { data =apiRepository.getData(); return data; } }
ApiViewModel extends ViewModel { @VisibleForTesting public LiveData<Resource<Example>> getData() { data =apiRepository.getData(); return data; } @Inject  ApiViewModel(ApiRepository apiRepository); }
ApiViewModel extends ViewModel { @VisibleForTesting public LiveData<Resource<Example>> getData() { data =apiRepository.getData(); return data; } @Inject  ApiViewModel(ApiRepository apiRepository); @VisibleForTesting LiveData<Resource<Example>> getData(); }
ApiViewModel extends ViewModel { @VisibleForTesting public LiveData<Resource<Example>> getData() { data =apiRepository.getData(); return data; } @Inject  ApiViewModel(ApiRepository apiRepository); @VisibleForTesting LiveData<Resource<Example>> getData();  }