@Test public void testGetAsyncWithNoInMemoryCurrentUserAndLazyLogin() throws Exception { ParseObjectStore<ParseUser> store = (ParseObjectStore<ParseUser>) mock(ParseObjectStore.class); when(store.getAsync()).thenReturn(Task.<ParseUser>forResult(null)); CachedCurrentUserController controller = new CachedCurrentUserController(store); ParseCorePlugins.getInstance().registerCurrentUserController(controller); controller.currentUserMatchesDisk = true; ParseUser currentUser = ParseTaskUtils.wait(controller.getAsync(true)); assertTrue(currentUser.isLazy()); assertTrue(currentUser.isCurrentUser()); assertSame(controller.currentUser, currentUser); assertFalse(controller.currentUserMatchesDisk); }
@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);  }