@Test public void getFormUpdateMode_whenProtocolIsGoogleDrive_andModeNotManual_returnsManual() { Context context = getApplicationContext(); SharedPreferences prefs = initPrefs( GeneralKeys.KEY_PROTOCOL, Protocol.GOOGLE.getValue(context), GeneralKeys.KEY_FORM_UPDATE_MODE, FormUpdateMode.PREVIOUSLY_DOWNLOADED_ONLY.getValue(context) ); FormUpdateMode formUpdateMode = SettingsUtils.getFormUpdateMode(context, prefs); assertThat(formUpdateMode, is(FormUpdateMode.MANUAL)); }
@NonNull public static FormUpdateMode getFormUpdateMode(Context context, SharedPreferences generalSharedPreferences) { String protocol = generalSharedPreferences.getString(GeneralKeys.KEY_PROTOCOL, null); if (Protocol.parse(context, protocol) == Protocol.GOOGLE) { return FormUpdateMode.MANUAL; } else { String mode = generalSharedPreferences.getString(GeneralKeys.KEY_FORM_UPDATE_MODE, null); return FormUpdateMode.parse(context, mode); } }
SettingsUtils { @NonNull public static FormUpdateMode getFormUpdateMode(Context context, SharedPreferences generalSharedPreferences) { String protocol = generalSharedPreferences.getString(GeneralKeys.KEY_PROTOCOL, null); if (Protocol.parse(context, protocol) == Protocol.GOOGLE) { return FormUpdateMode.MANUAL; } else { String mode = generalSharedPreferences.getString(GeneralKeys.KEY_FORM_UPDATE_MODE, null); return FormUpdateMode.parse(context, mode); } } }
SettingsUtils { @NonNull public static FormUpdateMode getFormUpdateMode(Context context, SharedPreferences generalSharedPreferences) { String protocol = generalSharedPreferences.getString(GeneralKeys.KEY_PROTOCOL, null); if (Protocol.parse(context, protocol) == Protocol.GOOGLE) { return FormUpdateMode.MANUAL; } else { String mode = generalSharedPreferences.getString(GeneralKeys.KEY_FORM_UPDATE_MODE, null); return FormUpdateMode.parse(context, mode); } } private  SettingsUtils(); }
SettingsUtils { @NonNull public static FormUpdateMode getFormUpdateMode(Context context, SharedPreferences generalSharedPreferences) { String protocol = generalSharedPreferences.getString(GeneralKeys.KEY_PROTOCOL, null); if (Protocol.parse(context, protocol) == Protocol.GOOGLE) { return FormUpdateMode.MANUAL; } else { String mode = generalSharedPreferences.getString(GeneralKeys.KEY_FORM_UPDATE_MODE, null); return FormUpdateMode.parse(context, mode); } } private  SettingsUtils(); @NonNull static FormUpdateMode getFormUpdateMode(Context context, SharedPreferences generalSharedPreferences); }
SettingsUtils { @NonNull public static FormUpdateMode getFormUpdateMode(Context context, SharedPreferences generalSharedPreferences) { String protocol = generalSharedPreferences.getString(GeneralKeys.KEY_PROTOCOL, null); if (Protocol.parse(context, protocol) == Protocol.GOOGLE) { return FormUpdateMode.MANUAL; } else { String mode = generalSharedPreferences.getString(GeneralKeys.KEY_FORM_UPDATE_MODE, null); return FormUpdateMode.parse(context, mode); } } private  SettingsUtils(); @NonNull static FormUpdateMode getFormUpdateMode(Context context, SharedPreferences generalSharedPreferences);  }