@Test public void testNull() { MutableLiveData<Resource<Example>> resourceMutableLiveData = new MutableLiveData<>(); when(apiViewModel.getData()).thenReturn(resourceMutableLiveData); assertThat(apiViewModel.getData(),notNullValue() ); 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();  }