@Test public void anyState() { AnyStateListener obj = mock(AnyStateListener.class); ReflectiveGenericLifecycleObserver observer = new ReflectiveGenericLifecycleObserver(obj); when(mLifecycle.getCurrentState()).thenReturn(STARTED); observer.onStateChanged(mOwner, ON_CREATE); verify(obj).onAnyState(mOwner, ON_CREATE); reset(obj); observer.onStateChanged(mOwner, ON_START); verify(obj).onAnyState(mOwner, ON_START); reset(obj); observer.onStateChanged(mOwner, ON_RESUME); verify(obj).onAnyState(mOwner, ON_RESUME); reset(obj); observer.onStateChanged(mOwner, ON_PAUSE); verify(obj).onAnyState(mOwner, ON_PAUSE); reset(obj); observer.onStateChanged(mOwner, ON_STOP); verify(obj).onAnyState(mOwner, ON_STOP); reset(obj); observer.onStateChanged(mOwner, ON_DESTROY); verify(obj).onAnyState(mOwner, ON_DESTROY); reset(obj); }
@Override public void onStateChanged(LifecycleOwner source, Event event) { mInfo.invokeCallbacks(source, event, mWrapped); }
ReflectiveGenericLifecycleObserver implements GenericLifecycleObserver { @Override public void onStateChanged(LifecycleOwner source, Event event) { mInfo.invokeCallbacks(source, event, mWrapped); } }
ReflectiveGenericLifecycleObserver implements GenericLifecycleObserver { @Override public void onStateChanged(LifecycleOwner source, Event event) { mInfo.invokeCallbacks(source, event, mWrapped); } ReflectiveGenericLifecycleObserver(Object wrapped); }
ReflectiveGenericLifecycleObserver implements GenericLifecycleObserver { @Override public void onStateChanged(LifecycleOwner source, Event event) { mInfo.invokeCallbacks(source, event, mWrapped); } ReflectiveGenericLifecycleObserver(Object wrapped); @Override void onStateChanged(LifecycleOwner source, Event event); }
ReflectiveGenericLifecycleObserver implements GenericLifecycleObserver { @Override public void onStateChanged(LifecycleOwner source, Event event) { mInfo.invokeCallbacks(source, event, mWrapped); } ReflectiveGenericLifecycleObserver(Object wrapped); @Override void onStateChanged(LifecycleOwner source, Event event);  }