@Test
public void whenAPreferenceHasAnIncorrectType_returnsFalse_andShowsToastError() {

    putBooleanToSharedPrefs("password", false);
    PreferenceFragment fragment = Robolectric.buildFragment(TestPreferenceFragment.class).create().resume().visible().get();
    AggregatePreferencesAdder loader = new AggregatePreferencesAdder(fragment);
    boolean result = loader.add();
    assertFalse(result);
    String toastText = ShadowToast.getTextOfLatestToast();
    assertEquals(toastText, getString(R.string.corrupt_imported_preferences_error));
}