/** * @return a CatalystInstance mock that has a default working ReactQueueConfiguration. */ public static CatalystInstance createMockCatalystInstance() { ReactQueueConfigurationSpec spec = ReactQueueConfigurationSpec.builder() .setJSQueueThreadSpec(MessageQueueThreadSpec.mainThreadSpec()) .setNativeModulesQueueThreadSpec(MessageQueueThreadSpec.mainThreadSpec()) .build(); ReactQueueConfiguration ReactQueueConfiguration = ReactQueueConfigurationImpl.create( spec, new QueueThreadExceptionHandler() { @Override public void handleException(Exception e) { throw new RuntimeException(e); } }); CatalystInstance reactInstance = mock(CatalystInstance.class); when(reactInstance.getReactQueueConfiguration()).thenReturn(ReactQueueConfiguration); when(reactInstance.getNativeModule(UIManagerModule.class)) .thenReturn(mock(UIManagerModule.class)); return reactInstance; }