Navigator extends ParentController { public void popToRoot(final String id, Options mergeOptions, CommandListener listener) { applyOnStack(id, listener, stack -> stack.popToRoot(mergeOptions, 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 popToRoot() { StackController stack1 = newStack(); StackController stack2 = newStack(); BottomTabsController bottomTabsController = newTabs(Arrays.asList(stack1, stack2)); uut.setRoot(bottomTabsController, new CommandListenerAdapter()); stack1.push(child1, new CommandListenerAdapter()); stack2.push(child2, new CommandListenerAdapter()); stack2.push(child3, new CommandListenerAdapter()); stack2.push(child4, new CommandListenerAdapter()); stack2.push(child5, new CommandListenerAdapter() { @Override public void onSuccess(String childId) { uut.popToRoot(child3.getId(), Options.EMPTY, new CommandListenerAdapter()); assertThat(stack2.getChildControllers()).containsOnly(child2); } }); }