Source:
public ActivityController<T> configurationChange(final Configuration newConfiguration) { final Configuration currentConfig = component.getResources().getConfiguration(); final int changedBits = currentConfig.diff(newConfiguration); currentConfig.setTo(newConfiguration); if ((getActivityInfo(component.getApplication()).configChanges & changedBits) == changedBits) { shadowMainLooper.runPaused(new Runnable() { @Override public void run() { ReflectionHelpers.callInstanceMethod(Activity.class, component, "onConfigurationChanged", ClassParameter.from(Configuration.class, newConfiguration)); } }); return this; } else { @SuppressWarnings("unchecked") final ActivityController<T> recreatedActivityController = Robolectric.buildActivity( (Class<T>) component.getClass(), component.getIntent()); shadowMainLooper.runPaused(new Runnable() { @Override public void run() { ReflectionHelpers.setField(Activity.class, component, "mChangingConfigurations", true); ReflectionHelpers.setField(Activity.class, component, "mConfigChangeFlags", changedBits); final Bundle outState = new Bundle(); ReflectionHelpers.callInstanceMethod(Activity.class, component, "onSaveInstanceState", ClassParameter.from(Bundle.class, outState)); ReflectionHelpers.callInstanceMethod(Activity.class, component, "onPause"); ReflectionHelpers.callInstanceMethod(Activity.class, component, "onStop"); final Object nonConfigInstance = ReflectionHelpers.callInstanceMethod( Activity.class, component, "onRetainNonConfigurationInstance"); ReflectionHelpers.callInstanceMethod(Activity.class, component, "onDestroy"); Shadows.shadowOf(recreatedActivityController.component).setLastNonConfigurationInstance(nonConfigInstance); ReflectionHelpers.callInstanceMethod(Activity.class, recreatedActivityController.component, "onCreate", ClassParameter.from(Bundle.class, outState)); ReflectionHelpers.callInstanceMethod(Activity.class, recreatedActivityController.component, "onStart"); ReflectionHelpers.callInstanceMethod(Activity.class, recreatedActivityController.component, "onRestoreInstanceState", ClassParameter.from(Bundle.class, outState)); ReflectionHelpers.callInstanceMethod(Activity.class, recreatedActivityController.component, "onResume"); } }); return recreatedActivityController; } }

Target:
public ActivityController<T> configurationChange(final Configuration newConfiguration) { final Configuration currentConfig = component.getResources().getConfiguration(); final int changedBits = currentConfig.diff(newConfiguration); currentConfig.setTo(newConfiguration); if ((getActivityInfo(component.getApplication()).configChanges & changedBits) == changedBits) { shadowMainLooper.runPaused(new Runnable() { @Override public void run() { ReflectionHelpers.callInstanceMethod(Activity.class, component, "onConfigurationChanged", ClassParameter.from(Configuration.class, newConfiguration)); } }); return this; } else { @SuppressWarnings("unchecked") final T recreatedActivity = (T) ReflectionHelpers.callConstructor(component.getClass()); shadowMainLooper.runPaused(new Runnable() { @Override public void run() { ReflectionHelpers.setField(Activity.class, component, "mChangingConfigurations", true); ReflectionHelpers.setField(Activity.class, component, "mConfigChangeFlags", changedBits); final Bundle outState = new Bundle(); ReflectionHelpers.callInstanceMethod(Activity.class, component, "onSaveInstanceState", ClassParameter.from(Bundle.class, outState)); ReflectionHelpers.callInstanceMethod(Activity.class, component, "onPause"); ReflectionHelpers.callInstanceMethod(Activity.class, component, "onStop"); final Object nonConfigInstance = ReflectionHelpers.callInstanceMethod( Activity.class, component, "onRetainNonConfigurationInstance"); ReflectionHelpers.callInstanceMethod(Activity.class, component, "onDestroy"); attached = false; component = recreatedActivity; shadowReference = shadowsAdapter.getShadowActivityAdapter(component); attach(); Shadows.shadowOf(recreatedActivity).setLastNonConfigurationInstance(nonConfigInstance); ReflectionHelpers.callInstanceMethod(Activity.class, recreatedActivity, "onCreate", ClassParameter.from(Bundle.class, outState)); ReflectionHelpers.callInstanceMethod(Activity.class, recreatedActivity, "onStart"); ReflectionHelpers.callInstanceMethod(Activity.class, recreatedActivity, "onRestoreInstanceState", ClassParameter.from(Bundle.class, outState)); ReflectionHelpers.callInstanceMethod(Activity.class, recreatedActivity, "onResume"); } }); } return this; }