### Question:
Navigator extends ParentController { public void push(final String id, final ViewController viewController, CommandListener listener) { applyOnStack(id, listener, stack -> stack.push(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, ReactInstanceManager reactInstanceManager); void mergeOptions(final String componentId, Options options); void push(final String id, final ViewController viewController, CommandListener listener); void setStackRoot(String id, List<ViewController> children, 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);  }### Answer:
@Test public void push() { StackController stackController = newStack(); stackController.push(child1, new CommandListenerAdapter()); uut.setRoot(stackController, new CommandListenerAdapter(), reactInstanceManager); assertIsChild(uut.getView(), stackController.getView()); assertIsChild(stackController.getView(), child1.getView()); uut.push(child1.getId(), child2, new CommandListenerAdapter()); assertIsChild(uut.getView(), stackController.getView()); assertIsChild(stackController.getView(), child2.getView()); }
@Test public void push_rejectIfNotContainedInStack() { CommandListener listener = Mockito.mock(CommandListener.class); uut.push("someId", child1, listener); verify(listener).onError(any()); }