We use Robolectric for our test cases at work which seems to not work well Action Bar Sherlock.
Problem is that I get a No implementations match configuration
message, because the Build.VERSION.SDK_INT
== 0 when run via robolectric.
If anyone has ideas on the best way of getting ABS working nice with Robolectric, I'd love to know. If I find out I'll post my results here, but it seems to be very hard to find information on how to make this popular toolkit and library work together.
Two ways to solve this:
Build.SDK_INT
value to a real value using this gross method call: RobolectricTestRunner.setStaticValue(Build.VERSION.class, "SDK_INT", 15);
@ActionBarSherlock.Implementation(api = 0)
(don't forget to call ActionBarSherlock.registerImplementation
as well).