User { User(@NonNull PreferenceDataStore preferenceDataStore, @NonNull AirshipChannel channel) { this.preferences = preferenceDataStore; this.channel = channel; String password = preferences.getString(USER_PASSWORD_KEY, null); if (!UAStringUtil.isEmpty(password)) { String userToken = encode(password, preferences.getString(USER_ID_KEY, null)); if (preferences.putSync(USER_TOKEN_KEY, userToken)) { preferences.remove(USER_PASSWORD_KEY); } } } User(@NonNull PreferenceDataStore preferenceDataStore, @NonNull AirshipChannel channel); void addListener(@NonNull Listener listener); void removeListener(@NonNull Listener listener); static boolean isCreated(); boolean isUserCreated(); @Nullable String getId(); @Nullable String getPassword();  }
@Test public void testUser() throws JSONException { user.setUser(fakeUserId, fakeToken); assertEquals("User ID should match", fakeUserId, user.getId()); assertEquals("User password should match", fakeToken, user.getPassword()); }