Have you tried Robolectric? https://github.com/robolectric/robolectric https://github.com/robolectric/gradle-android-test-plugin
On Saturday, March 22, 2014 5:38:32 AM UTC-3, Boaz Yagodiner wrote: > > Hi Xavier (and others), > > I tried to work with 2 modules with Android Studio but it works only > partially (or maybe I missed something and you can correct me). > One of the reasons is that a lot of code needs access to the activities > and fragments and they are in the Android module. While I can do things to > override it makes the code far from clean. > > So I tried this way: > Suppose I have a MyActivity. I also created MyActivityImpl such that: > 1. MyActivityImpl doesn't inherit from Activity but it gets a reference to > MyActivity so that it can call the Activity methods. This way I can mock > the myActivity reference and unit test. > 2. Each method in MyActivity contains one line - It simply delegates to > MyActivityImpl. > > The only problem with this is that some of Activity methods are final so > Mockito can't override them. > > > Can you help? > Can you deliver android.jar without final keywords? > > > Thanks, > Boaz Yagodiner > > -- You received this message because you are subscribed to the Google Groups "adt-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
