public final class ViewModelScenario<VM extends ViewModel>


ViewModelScenario provides API to start and drive a ViewModel's lifecycle state for testing.

Summary

Public methods

void

Finishes the managed ViewModel and clear the ViewModelStore.

final @NonNull VM

The current ViewModel.

Public methods

close

Added in 2.9.0-alpha05
public void close()

Finishes the managed ViewModel and clear the ViewModelStore.

getViewModel

Added in 2.9.0-alpha05
public final @NonNull VM getViewModel()

The current ViewModel. The instance might update if the ViewModelStore is cleared.