I'm trying to test class that queries content resolver.
I would like to use MockContentResolver and mock query method.
The problem is that this method is final. What should I do? Use mocking framework? Mock other class? Thanks in advance.
public class CustomClass {
private ContentResolver mContentResolver;
public CustomClass(ContentResolver contentResolver) {
mContentResolver = contentResolver;
}
public String getConfig(String key) throws NoSuchFieldException {
String value = null;
Cursor cursor = getContentResolver().query(...);
if (cursor.moveToFirst()) {
//...
}
//..
}
}