protected int parseExpire(CacheContext ctx) throws AttributeDefineException {
Method targetMethod = ctx.getTargetMethod();
CacheEnable cacheEnable = targetMe
I found JMockit easier to use ans switched to it completely. See test cases using it:
https://github.com/ko5tik/andject/blob/master/src/test/java/de/pribluda/android/andject/ViewInjectionTest.java
Here I mock away Activity base class, which is coming from Android SKD and completely stubbed. With JMockit you can mock thingis tha are final, private, abstract or whatever else.
In your testcase it would look like:
public void testFoo(@Mocked final Method targetMethod,
@Mocked final CacheContext context,
@Mocked final CacheExpire ce) {
new Expectations() {
{
// specify expected sequence of infocations here
context.getTargetMethod(); returns(method);
}
};
// call your method
assertSomething(objectUndertest.cacheExpire(context))