ActivityDelegate extends MvvmDelegate<T, S> { @Nullable @Override @SuppressWarnings("unchecked") protected S getCachedViewModel() { return (S) callback.getLastCustomNonConfigurationInstance(); } ActivityDelegate(@NonNull ActivityDelegateCallback<T, S> callback, @NonNull Activity delegatedActivity); @Nullable Object onRetainCustomNonConfigurationInstance();  }
@Test public void testGetCachedViewModelFromCallback() { when(callback.getLastCustomNonConfigurationInstance()).thenReturn(viewModel); assertSame(activityDelegate.getCachedViewModel(), viewModel); }