@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);
    } catch (Exception e) {
        assertThat("exception cause is wrong",
                e.getCause() instanceof UnprecedentedError);
    }
}