@Test public void setRoot_animates() { Options animatedSetRoot = new Options(); animatedSetRoot.animations.setRoot = new AnimationOptions() { @Override public boolean hasAnimation() { return true; } }; ViewController spy = spy(root); when(spy.resolveCurrentOptions(defaultOptions)).thenReturn(animatedSetRoot); CommandListenerAdapter listener = spy(new CommandListenerAdapter()); uut.setRoot(spy, defaultOptions, listener); verify(animator).setRoot(eq(spy.getView()), eq(animatedSetRoot.animations.setRoot), any()); verify(listener).onSuccess(spy.getId()); }
public void setRoot(ViewController root, Options defaultOptions, CommandListener listener) { rootLayout.addView(root.getView()); Options options = root.resolveCurrentOptions(defaultOptions); if (options.animations.setRoot.hasAnimation()) { animator.setRoot(root.getView(), options.animations.setRoot, () -> listener.onSuccess(root.getId())); } else { listener.onSuccess(root.getId()); } }
RootPresenter { public void setRoot(ViewController root, Options defaultOptions, CommandListener listener) { rootLayout.addView(root.getView()); Options options = root.resolveCurrentOptions(defaultOptions); if (options.animations.setRoot.hasAnimation()) { animator.setRoot(root.getView(), options.animations.setRoot, () -> listener.onSuccess(root.getId())); } else { listener.onSuccess(root.getId()); } } }
RootPresenter { public void setRoot(ViewController root, Options defaultOptions, CommandListener listener) { rootLayout.addView(root.getView()); Options options = root.resolveCurrentOptions(defaultOptions); if (options.animations.setRoot.hasAnimation()) { animator.setRoot(root.getView(), options.animations.setRoot, () -> listener.onSuccess(root.getId())); } else { listener.onSuccess(root.getId()); } } RootPresenter(Context context);   RootPresenter(NavigationAnimator animator); }
RootPresenter { public void setRoot(ViewController root, Options defaultOptions, CommandListener listener) { rootLayout.addView(root.getView()); Options options = root.resolveCurrentOptions(defaultOptions); if (options.animations.setRoot.hasAnimation()) { animator.setRoot(root.getView(), options.animations.setRoot, () -> listener.onSuccess(root.getId())); } else { listener.onSuccess(root.getId()); } } RootPresenter(Context context);   RootPresenter(NavigationAnimator animator); void setRootContainer(FrameLayout rootLayout); void setRoot(ViewController root, Options defaultOptions, CommandListener listener); }
RootPresenter { public void setRoot(ViewController root, Options defaultOptions, CommandListener listener) { rootLayout.addView(root.getView()); Options options = root.resolveCurrentOptions(defaultOptions); if (options.animations.setRoot.hasAnimation()) { animator.setRoot(root.getView(), options.animations.setRoot, () -> listener.onSuccess(root.getId())); } else { listener.onSuccess(root.getId()); } } RootPresenter(Context context);   RootPresenter(NavigationAnimator animator); void setRootContainer(FrameLayout rootLayout); void setRoot(ViewController root, Options defaultOptions, CommandListener listener);  }