Navigator extends ParentController { public void setStackRoot(String id, ViewController viewController, CommandListener listener) { applyOnStack(id, listener, stack -> stack.setRoot(viewController, listener)); } Navigator(final Activity activity, ChildControllersRegistry childRegistry, ModalStack modalStack, OverlayManager overlayManager, RootPresenter rootPresenter); @Override void setDefaultOptions(Options defaultOptions); Options getDefaultOptions(); FrameLayout getRootLayout(); void setEventEmitter(EventEmitter eventEmitter); void setContentLayout(ViewGroup contentLayout); void bindViews(); @NonNull @Override Collection<ViewController> getChildControllers(); @Override boolean handleBack(CommandListener listener); @Override void destroy(); void destroyViews(); @Override void sendOnNavigationButtonPressed(String buttonId); void setRoot(final ViewController viewController, CommandListener commandListener); void mergeOptions(final String componentId, Options options); void push(final String id, final ViewController viewController, CommandListener listener); void setStackRoot(String id, ViewController viewController, CommandListener listener); void pop(String id, Options mergeOptions, CommandListener listener); void popToRoot(final String id, Options mergeOptions, CommandListener listener); void popTo(final String id, Options mergeOptions, CommandListener listener); void showModal(final ViewController viewController, CommandListener listener); void dismissModal(final String componentId, CommandListener listener); void dismissAllModals(Options mergeOptions, CommandListener listener); void showOverlay(ViewController overlay, CommandListener listener); void dismissOverlay(final String componentId, CommandListener listener); @Nullable @Override ViewController findController(String id);  }
@Test public void setStackRoot() { disablePushAnimation(child1, child2, child3); StackController stack = newStack(); uut.setRoot(stack, new CommandListenerAdapter()); stack.push(child1, new CommandListenerAdapter()); stack.push(child2, new CommandListenerAdapter()); stack.setRoot(child3, new CommandListenerAdapter()); assertThat(stack.getChildControllers()).containsOnly(child3); }