RNInstabugChatsModule extends ReactContextBaseJavaModule { @ReactMethod public void setEnabled(final boolean isEnabled) { MainThreadHandler.runOnMainThread(new Runnable() { @Override public void run() { try { if (isEnabled) { Chats.setState(Feature.State.ENABLED); } else { Chats.setState(Feature.State.DISABLED); } } catch (Exception e) { e.printStackTrace(); } } }); } RNInstabugChatsModule(ReactApplicationContext reactApplicationContext); @Nonnull @Override String getName(); @ReactMethod void setEnabled(final boolean isEnabled); @ReactMethod void show();  }
@Test public void givenFalse$setChatsEnabled_whenQuery_thenShouldCallNativeApiWithDisabled() { PowerMockito.mockStatic(Chats.class); chatsModule.setEnabled(false); PowerMockito.verifyStatic(VerificationModeFactory.times(1)); Chats.setState(Feature.State.DISABLED); }
@Test public void givenTrue$setChatsEnabled_whenQuery_thenShouldCallNativeApiWithEnabled() { PowerMockito.mockStatic(Chats.class); chatsModule.setEnabled(true); PowerMockito.verifyStatic(VerificationModeFactory.times(1)); Chats.setState(Feature.State.ENABLED); }