use of com.reactnativenavigation.mocks.SimpleViewController in project react-native-navigation by wix.
the class ChildControllerTest method beforeEach.
@Override
public void beforeEach() {
childRegistry = spy(new ChildControllersRegistry());
presenter = Mockito.mock(Presenter.class);
uut = new SimpleViewController(newActivity(), childRegistry, "childId", presenter, new Options()) {
@Override
public Options resolveCurrentOptions() {
return resolvedOptions;
}
};
ParentController<?> parent = Mockito.mock(ParentController.class);
Mockito.when(parent.resolveChildOptions(uut)).thenReturn(Options.EMPTY);
uut.setParentController(parent);
}
use of com.reactnativenavigation.mocks.SimpleViewController in project react-native-navigation by wix.
the class ModalStackTest method handleBack_ViewControllerTakesPrecedenceOverModal.
@Test
public void handleBack_ViewControllerTakesPrecedenceOverModal() {
ViewController<?> backHandlingModal = spy(new SimpleViewController(activity, childRegistry, "stack", new Options()) {
@Override
public boolean handleBack(CommandListener listener) {
return true;
}
});
uut.showModal(backHandlingModal, root, new CommandListenerAdapter());
root.getView().getViewTreeObserver().dispatchOnGlobalLayout();
assertThat(uut.handleBack(new CommandListenerAdapter(), any())).isTrue();
verify(backHandlingModal, times(1)).handleBack(any());
verify(backHandlingModal, times(0)).onViewDisappear();
}
Aggregations