I am new to the Robolectric ,please help me understand it , what is the difference between these
loginActivity = new LoginActivity(); loginActivity = Robolectric.setupActivity(LoginActivity.class); loginActivity = Robolectric.buildActivity(LoginActivity.class).create().start().resume().get();
You should take a look at the implementation of the setup method. After following the call hierarchy you will find the following lines
Robolectric class method setup()
return ActivityController.of(shadowsAdapter, activityClass).setup().get();
ActivityController class method setup()
return create().start().postCreate(null).resume().visible();
No you can compare your custom call chain with the chain from setup method. Here is the code: https://github.com/robolectric/robolectric/blob/770f4bc5a95a58ea1cd1238e4b1d51977b1bb17a/robolectric/src/main/java/org/robolectric/util/ActivityController.java#L210
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With