@Test
public void fromJSON_whenPreferencesAreValid_callsSuccessListener() throws Exception {

    JSONObject content = new JSONObject();
    JSONObject general = new JSONObject();
    content.put("general", general);
    content.put("admin", new JSONObject());
    general.put(KEY_PASSWORD, "password");
    ActionListener listener = mock(ActionListener.class);
    GeneralSharedPreferences generalSharedPreferences = mock(GeneralSharedPreferences.class);
    new PreferenceSaver(generalSharedPreferences, AdminSharedPreferences.getInstance()).fromJSON(content.toString(), listener);
    verify(listener).onSuccess();
}