I am writing an Android ApplicationTestCase (TemperatureConverterApplicationTests example found in Android Application Testing Guide by Diego T. Milano on page 171). Th
I get this behaviour too. I've worked around it by extending ContextWrapper:
public class RenamingMockContext extends RenamingDelegatingContext
{
private static final String PREFIX = "test.";
public RenamingMockContext(Context context)
{
super(new ContextWrapper(context), PREFIX);
}
@Override
public String getPackageName()
{
return PREFIX + super.getPackageName();
}
}