LifecycleRegistry extends Lifecycle { @MainThread public void setCurrentState(@NonNull State state) { moveToState(state); } LifecycleRegistry(@NonNull LifecycleOwner provider); @Deprecated @MainThread void markState(@NonNull State state); @MainThread void setCurrentState(@NonNull State state); void handleLifecycleEvent(@NonNull Lifecycle.Event event); @Override void addObserver(@NonNull LifecycleObserver observer); @Override void removeObserver(@NonNull LifecycleObserver observer); @SuppressWarnings("WeakerAccess") int getObserverCount(); @NonNull @Override State getCurrentState();  }
@Test public void setCurrentState() { mRegistry.setCurrentState(Lifecycle.State.RESUMED); assertThat(mRegistry.getCurrentState(), is(Lifecycle.State.RESUMED)); mRegistry.setCurrentState(Lifecycle.State.DESTROYED); assertThat(mRegistry.getCurrentState(), is(Lifecycle.State.DESTROYED)); }