Static methods are supported, just like a non-static method.
In your case you could do something this:
public class ShadowPreferenceManager {
...
@Implements
public static SharedPreferences getDefaultSharedPreferences(Context context) {
return new TestSharedPreferences("__default__", MODE_PRIVATE);
}
}
This will work because the backing map inside of TestSharedPreferences is static, and is reset between tests in TestHelper.
If you want to set preconditions, just use the PreferencesManager directly before you execute the app logic in your test.
--T$