Remove ActivityController and FragmentController withIntent APIs.
diff --git a/robolectric/src/main/java/org/robolectric/android/controller/ActivityController.java b/robolectric/src/main/java/org/robolectric/android/controller/ActivityController.java
index 32fa8a1..7150cfa 100644
--- a/robolectric/src/main/java/org/robolectric/android/controller/ActivityController.java
+++ b/robolectric/src/main/java/org/robolectric/android/controller/ActivityController.java
@@ -33,21 +33,6 @@
super(shadowsAdapter, activity, intent);
}
- /**
- * @deprecated Use {@link org.robolectric.Robolectric#buildActivity(Class, Intent)} instead.
- *
- * This method will be removed in Robolectric 3.4.
- */
- @Deprecated
- public ActivityController<T> withIntent(Intent intent) {
- super.withIntent(intent);
-
- // This is a hack to support existing usages where withIntent() is called after attach().
- ReflectionHelpers.setField(component, "mIntent", getIntent());
- ReflectionHelpers.setField(component, "mComponent", getIntent().getComponent());
- return myself;
- }
-
private ActivityController<T> attach() {
if (attached) {
return this;
diff --git a/robolectric/src/main/java/org/robolectric/android/controller/ComponentController.java b/robolectric/src/main/java/org/robolectric/android/controller/ComponentController.java
index 3250506..22610e9 100644
--- a/robolectric/src/main/java/org/robolectric/android/controller/ComponentController.java
+++ b/robolectric/src/main/java/org/robolectric/android/controller/ComponentController.java
@@ -34,17 +34,6 @@
return component;
}
- /**
- * @deprecated Use the appropriate builder in {@link org.robolectric.Robolectric} instead.
- *
- * This method will be removed in Robolectric 3.4.
- */
- @Deprecated
- public C withIntent(Intent intent) {
- this.intent = intent;
- return myself;
- }
-
public abstract C create();
public abstract C destroy();
diff --git a/robolectric/src/main/java/org/robolectric/android/controller/FragmentController.java b/robolectric/src/main/java/org/robolectric/android/controller/FragmentController.java
index 35ccf22..2c2a8a4 100644
--- a/robolectric/src/main/java/org/robolectric/android/controller/FragmentController.java
+++ b/robolectric/src/main/java/org/robolectric/android/controller/FragmentController.java
@@ -133,23 +133,6 @@
return this;
}
- /**
- * @deprecated Use {@link org.robolectric.Robolectric#buildFragment(Class, Class, Intent)} instead.
- *
- * This method will be removed in Robolectric 3.4.
- */
- @Deprecated
- @Override
- public FragmentController<F> withIntent(final Intent intent) {
- shadowMainLooper.runPaused(new Runnable() {
- @Override
- public void run() {
- activityController.withIntent(intent);
- }
- });
- return this;
- }
-
private static class FragmentControllerActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
diff --git a/robolectric/src/main/java/org/robolectric/android/controller/IntentServiceController.java b/robolectric/src/main/java/org/robolectric/android/controller/IntentServiceController.java
index 2c5ec9c..244f60a 100644
--- a/robolectric/src/main/java/org/robolectric/android/controller/IntentServiceController.java
+++ b/robolectric/src/main/java/org/robolectric/android/controller/IntentServiceController.java
@@ -92,4 +92,15 @@
invokeWhilePaused("onHandleIntent", from(Intent.class, getIntent()));
return this;
}
+
+ /**
+ * @deprecated Use the appropriate builder in {@link org.robolectric.Robolectric} instead.
+ *
+ * This method will be removed in Robolectric 3.6.
+ */
+ @Deprecated
+ public IntentServiceController<T> withIntent(Intent intent) {
+ this.intent = intent;
+ return this;
+ }
}
\ No newline at end of file
diff --git a/robolectric/src/main/java/org/robolectric/android/controller/ServiceController.java b/robolectric/src/main/java/org/robolectric/android/controller/ServiceController.java
index dd8bc35..9d6ea63 100644
--- a/robolectric/src/main/java/org/robolectric/android/controller/ServiceController.java
+++ b/robolectric/src/main/java/org/robolectric/android/controller/ServiceController.java
@@ -83,4 +83,15 @@
invokeWhilePaused("onUnbind", from(Intent.class, getIntent()));
return this;
}
+
+ /**
+ * @deprecated Use the appropriate builder in {@link org.robolectric.Robolectric} instead.
+ *
+ * This method will be removed in Robolectric 3.6.
+ */
+ @Deprecated
+ public ServiceController<T> withIntent(Intent intent) {
+ this.intent = intent;
+ return this;
+ }
}
diff --git a/robolectric/src/test/java/org/robolectric/android/controller/FragmentControllerTest.java b/robolectric/src/test/java/org/robolectric/android/controller/FragmentControllerTest.java
index e089980..89ccf6c 100644
--- a/robolectric/src/test/java/org/robolectric/android/controller/FragmentControllerTest.java
+++ b/robolectric/src/test/java/org/robolectric/android/controller/FragmentControllerTest.java
@@ -122,20 +122,6 @@
}
@Test
- public void withIntent_deprecated() {
- final LoginFragment fragment = new LoginFragment();
- final FragmentController<LoginFragment> controller = FragmentController.of(fragment, LoginActivity.class);
-
- Intent intent = new Intent("test_action");
- intent.putExtra("test_key", "test_value");
- controller.withIntent(intent).create();
-
- Intent intentInFragment = controller.get().getActivity().getIntent();
- assertThat(intentInFragment.getAction()).isEqualTo("test_action");
- assertThat(intentInFragment.getExtras().getString("test_key")).isEqualTo("test_value");
- }
-
- @Test
public void withIntent() {
final LoginFragment fragment = new LoginFragment();
diff --git a/shadows/supportv4/src/main/java/org/robolectric/shadows/support/v4/SupportFragmentController.java b/shadows/supportv4/src/main/java/org/robolectric/shadows/support/v4/SupportFragmentController.java
index 273457f..30c497e 100644
--- a/shadows/supportv4/src/main/java/org/robolectric/shadows/support/v4/SupportFragmentController.java
+++ b/shadows/supportv4/src/main/java/org/robolectric/shadows/support/v4/SupportFragmentController.java
@@ -127,23 +127,6 @@
return this;
}
- /**
- * @deprecated Use {@link #of(Fragment, Class, Intent)} instead.
- *
- * This method will be removed in Robolectric 3.4.
- */
- @Deprecated
- @Override
- public SupportFragmentController<F> withIntent(final Intent intent) {
- shadowMainLooper.runPaused(new Runnable() {
- @Override
- public void run() {
- activityController.withIntent(intent);
- }
- });
- return this;
- }
-
private static class FragmentControllerActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {