-
Notifications
You must be signed in to change notification settings - Fork 44
Robolectric
Robolectric manipulates JVM class loader to provide shadow classes instead of real implementations. Without this manipulation all code which point Android class gets RuntimeException with message "Stub!". Modified class loader binds Stub class to its corresponding shadows. For example calling new TextView you would get ShadowTextView. It's kind of trick but works. Unfortunately Robolectric doesn't not provide all android classes and methods. Sometimes you can miss some code. Calling method from shadow class which actually doesn't have this implementation would just return default value (for int -> 0, for String "").
We're providing annotation @UseShadows which collects given classes and bind them to Robolectric environment. From now you're able to extend Robolectric, no more configuration is needed.