@Test public void testFailingObserver() { class UnprecedentedError extends Error { } LifecycleObserver obj = new LifecycleObserver() { @OnLifecycleEvent(ON_START) void started() { throw new UnprecedentedError(); } }; ReflectiveGenericLifecycleObserver observer = new ReflectiveGenericLifecycleObserver(obj); try { observer.onStateChanged(mOwner, ON_START); fail(); } catch (Exception e) { assertThat("exception cause is wrong", e.getCause() instanceof UnprecedentedError); } }
@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);  }