### Question:
ModalStack { ViewController peek() { if (modals.isEmpty()) throw new EmptyStackException(); return modals.get(modals.size() - 1); } ModalStack(Activity activity); @RestrictTo(RestrictTo.Scope.TESTS)  ModalStack(ModalPresenter presenter); void setEventEmitter(EventEmitter eventEmitter); void setModalsLayout(ViewGroup modalsLayout); void setRootLayout(ViewGroup rootLayout); void setDefaultOptions(Options defaultOptions); void showModal(ViewController viewController, ViewController root, CommandListener listener); boolean dismissModal(String componentId, @Nullable ViewController root, CommandListener listener); void dismissAllModals(ViewController root, Options mergeOptions, CommandListener listener); boolean handleBack(CommandListener listener, ViewController root); ViewController get(int index); boolean isEmpty(); int size(); @Nullable ViewController findControllerById(String componentId); void destroy();  }### Answer:
@Test public void peek() { assertThat(uut.isEmpty()).isTrue(); assertThatThrownBy(() -> uut.peek()).isInstanceOf(EmptyStackException.class); uut.showModal(modal1, root, new CommandListenerAdapter() { @Override public void onSuccess(String childId) { assertThat(uut.peek()).isEqualTo(modal1); } }); }