Refactor test.
Add test restore provider from preferences.