@Test public void eachEvent() { AllMethodsListener obj = mock(AllMethodsListener.class); ReflectiveGenericLifecycleObserver observer = new ReflectiveGenericLifecycleObserver(obj); when(mLifecycle.getCurrentState()).thenReturn(CREATED); observer.onStateChanged(mOwner, ON_CREATE); verify(obj).created(); reset(obj); when(mLifecycle.getCurrentState()).thenReturn(STARTED); observer.onStateChanged(mOwner, ON_START); verify(obj).started(); reset(obj); when(mLifecycle.getCurrentState()).thenReturn(RESUMED); observer.onStateChanged(mOwner, ON_RESUME); verify(obj).resumed(); reset(obj); when(mLifecycle.getCurrentState()).thenReturn(STARTED); observer.onStateChanged(mOwner, ON_PAUSE); verify(obj).paused(); reset(obj); when(mLifecycle.getCurrentState()).thenReturn(CREATED); observer.onStateChanged(mOwner, ON_STOP); verify(obj).stopped(); reset(obj); when(mLifecycle.getCurrentState()).thenReturn(INITIALIZED); observer.onStateChanged(mOwner, ON_DESTROY); verify(obj).destroyed(); 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);  }