RNInstabugSurveysModule extends ReactContextBaseJavaModule { @ReactMethod public void showSurveysIfAvailable() { MainThreadHandler.runOnMainThread(new Runnable() { @Override public void run() { try { Surveys.showSurveyIfAvailable(); } catch (java.lang.Exception exception) { exception.printStackTrace(); } } }); } RNInstabugSurveysModule(ReactApplicationContext reactContext); @Nonnull @Override String getName(); @ReactMethod void hasRespondedToSurvey(final String surveyToken, final Callback hasRespondedCallback); @ReactMethod void showSurvey(final String surveyToken); @ReactMethod void showSurveysIfAvailable(); @ReactMethod void setEnabled(final boolean isEnabled); @ReactMethod void setOnShowHandler(final Callback handler); @ReactMethod void setOnDismissHandler(final Callback handler); @ReactMethod void setThresholdForReshowingSurveyAfterDismiss(final int sessionsCount, final int daysCount); @ReactMethod void getAvailableSurveys(final Callback availableSurveysCallback); @ReactMethod void setAutoShowingEnabled(final boolean autoShowingSurveysEnabled); @ReactMethod void setShouldShowWelcomeScreen(final boolean shouldShow);  }
@Test public void given$showSurveysIfAvailable_whenQuery_thenShouldCallNativeApi() { PowerMockito.mockStatic(Surveys.class); surveysModule.showSurveysIfAvailable(); PowerMockito.verifyStatic(VerificationModeFactory.times(1)); Surveys.showSurveyIfAvailable(); }