### Question:
LiteCycle implements LifecycleObserver { public static <T> LiteObserverFactory<T> defer(Callable<T> itemInitializer) { return new LiteObserverFactory<>(itemInitializer); }  static LiteObserverFactory<T> defer(Callable<T> itemInitializer); static LiteObserverFactory<T> with(T item);  }### Answer:
@Test public void deferWithCallableThenInvokeCallOnFirstInvoke() { final boolean[] result = new boolean[]{false}; MockLifeCycleOwner owner = new MockLifeCycleOwner(); LiteCycle .defer(new Callable<Integer>() { @Override public Integer call() throws Exception { result[0] = true; return 0; } }) .forLifeCycle(owner) .onResumeInvoke(new Consumer<Integer>() { @Override public void accept(Integer integer) throws Exception { } }) .observe(); owner.create(); if (result[0]) { throw new AssertionFailedError("lazy initialization happened before update()"); } owner.resume(); assertTrue(result[0]); }
@Test public void deferWithCallableThenInvokeCallOnFirstUpdate() { final boolean[] result = new boolean[]{false}; MockLifeCycleOwner owner = new MockLifeCycleOwner(); LiteCycle .defer(new Callable<Integer>() { @Override public Integer call() throws Exception { result[0] = true; return 0; } }) .forLifeCycle(owner) .onResumeUpdate(new Function<Integer, Integer>() { @Override public Integer apply(Integer integer) throws Exception { return 1; } }) .observe(); owner.create(); if (result[0]) { throw new AssertionFailedError("lazy initialization happened before update()"); } owner.resume(); assertTrue(result[0]); }