@Test public void testGetAsyncWithCurrentUserReadFromDiskSuccess() throws Exception { ParseUser.State state = new ParseUser.State.Builder() .put("key", "value") .build(); ParseUser currentUserInDisk = ParseObject.from(state); ParseObjectStore<ParseUser> store = (ParseObjectStore<ParseUser>) mock(ParseObjectStore.class); when(store.getAsync()).thenReturn(Task.forResult(currentUserInDisk)); CachedCurrentUserController controller = new CachedCurrentUserController(store); ParseUser currentUser = ParseTaskUtils.wait(controller.getAsync(false)); assertSame(currentUser, currentUserInDisk); assertSame(currentUser, controller.currentUser); assertTrue(controller.currentUserMatchesDisk); assertTrue(currentUser.isCurrentUser()); assertEquals("value", currentUser.get("key")); }
@Override public Task<ParseUser> getAsync() { return getAsync(ParseUser.isAutomaticUserEnabled()); }
CachedCurrentUserController implements ParseCurrentUserController { @Override public Task<ParseUser> getAsync() { return getAsync(ParseUser.isAutomaticUserEnabled()); } }
CachedCurrentUserController implements ParseCurrentUserController { @Override public Task<ParseUser> getAsync() { return getAsync(ParseUser.isAutomaticUserEnabled()); } CachedCurrentUserController(ParseObjectStore<ParseUser> store); }
CachedCurrentUserController implements ParseCurrentUserController { @Override public Task<ParseUser> getAsync() { return getAsync(ParseUser.isAutomaticUserEnabled()); } CachedCurrentUserController(ParseObjectStore<ParseUser> store); @Override Task<Void> setAsync(final ParseUser user); @Override Task<Void> setIfNeededAsync(ParseUser user); @Override Task<ParseUser> getAsync(); @Override Task<Boolean> existsAsync(); @Override boolean isCurrent(ParseUser user); @Override void clearFromMemory(); @Override void clearFromDisk(); @Override Task<String> getCurrentSessionTokenAsync(); @Override Task<Void> logOutAsync(); @Override Task<ParseUser> getAsync(final boolean shouldAutoCreateUser); }
CachedCurrentUserController implements ParseCurrentUserController { @Override public Task<ParseUser> getAsync() { return getAsync(ParseUser.isAutomaticUserEnabled()); } CachedCurrentUserController(ParseObjectStore<ParseUser> store); @Override Task<Void> setAsync(final ParseUser user); @Override Task<Void> setIfNeededAsync(ParseUser user); @Override Task<ParseUser> getAsync(); @Override Task<Boolean> existsAsync(); @Override boolean isCurrent(ParseUser user); @Override void clearFromMemory(); @Override void clearFromDisk(); @Override Task<String> getCurrentSessionTokenAsync(); @Override Task<Void> logOutAsync(); @Override Task<ParseUser> getAsync(final boolean shouldAutoCreateUser);  }