@Test public void saveCredentialsPreferencesMethod_shouldSaveNewCredentialsAndReloadPropertyManager() { WebCredentialsUtils webCredentialsUtils = new WebCredentialsUtils(); GeneralSharedPreferences generalSharedPreferences = mock(GeneralSharedPreferences.class); PropertyManager propertyManager = mock(PropertyManager.class); webCredentialsUtils.saveCredentialsPreferences(generalSharedPreferences, "username", "password", propertyManager); verify(generalSharedPreferences, times(1)).save(GeneralKeys.KEY_USERNAME, "username"); verify(generalSharedPreferences, times(1)).save(GeneralKeys.KEY_PASSWORD, "password"); verify(propertyManager, times(1)).reload(); }
public void saveCredentialsPreferences(GeneralSharedPreferences generalSharedPreferences, String userName, String password, PropertyManager propertyManager) { generalSharedPreferences.save(GeneralKeys.KEY_USERNAME, userName); generalSharedPreferences.save(GeneralKeys.KEY_PASSWORD, password); propertyManager.reload(); }
WebCredentialsUtils { public void saveCredentialsPreferences(GeneralSharedPreferences generalSharedPreferences, String userName, String password, PropertyManager propertyManager) { generalSharedPreferences.save(GeneralKeys.KEY_USERNAME, userName); generalSharedPreferences.save(GeneralKeys.KEY_PASSWORD, password); propertyManager.reload(); } }
WebCredentialsUtils { public void saveCredentialsPreferences(GeneralSharedPreferences generalSharedPreferences, String userName, String password, PropertyManager propertyManager) { generalSharedPreferences.save(GeneralKeys.KEY_USERNAME, userName); generalSharedPreferences.save(GeneralKeys.KEY_PASSWORD, password); propertyManager.reload(); }  }
WebCredentialsUtils { public void saveCredentialsPreferences(GeneralSharedPreferences generalSharedPreferences, String userName, String password, PropertyManager propertyManager) { generalSharedPreferences.save(GeneralKeys.KEY_USERNAME, userName); generalSharedPreferences.save(GeneralKeys.KEY_PASSWORD, password); propertyManager.reload(); }  void saveCredentials(@NonNull String url, @NonNull String username, @NonNull String password); void saveCredentialsPreferences(GeneralSharedPreferences generalSharedPreferences, String userName, String password, PropertyManager propertyManager); void clearCredentials(@NonNull String url); String getServerUrlFromPreferences(); String getPasswordFromPreferences(); String getUserNameFromPreferences(); @Nullable HttpCredentialsInterface getCredentials(@NonNull URI url); }
WebCredentialsUtils { public void saveCredentialsPreferences(GeneralSharedPreferences generalSharedPreferences, String userName, String password, PropertyManager propertyManager) { generalSharedPreferences.save(GeneralKeys.KEY_USERNAME, userName); generalSharedPreferences.save(GeneralKeys.KEY_PASSWORD, password); propertyManager.reload(); }  void saveCredentials(@NonNull String url, @NonNull String username, @NonNull String password); void saveCredentialsPreferences(GeneralSharedPreferences generalSharedPreferences, String userName, String password, PropertyManager propertyManager); void clearCredentials(@NonNull String url); String getServerUrlFromPreferences(); String getPasswordFromPreferences(); String getUserNameFromPreferences(); @Nullable HttpCredentialsInterface getCredentials(@NonNull URI url);  }