@Test public void testGetCurrentSessionTokenAsyncWithCurrentUserSet() throws Exception { CachedCurrentUserController controller = new CachedCurrentUserController(null); ParseUser currentUser = mock(ParseUser.class); when(currentUser.getSessionToken()).thenReturn("sessionToken"); controller.currentUser = currentUser; String sessionToken = ParseTaskUtils.wait(controller.getCurrentSessionTokenAsync()); assertEquals("sessionToken", sessionToken); }
@Override public Task<String> getCurrentSessionTokenAsync() { return getAsync(false).onSuccess(new Continuation<ParseUser, String>() { @Override public String then(Task<ParseUser> task) { ParseUser user = task.getResult(); return user != null ? user.getSessionToken() : null; } }); }
CachedCurrentUserController implements ParseCurrentUserController { @Override public Task<String> getCurrentSessionTokenAsync() { return getAsync(false).onSuccess(new Continuation<ParseUser, String>() { @Override public String then(Task<ParseUser> task) { ParseUser user = task.getResult(); return user != null ? user.getSessionToken() : null; } }); } }
CachedCurrentUserController implements ParseCurrentUserController { @Override public Task<String> getCurrentSessionTokenAsync() { return getAsync(false).onSuccess(new Continuation<ParseUser, String>() { @Override public String then(Task<ParseUser> task) { ParseUser user = task.getResult(); return user != null ? user.getSessionToken() : null; } }); } CachedCurrentUserController(ParseObjectStore<ParseUser> store); }
CachedCurrentUserController implements ParseCurrentUserController { @Override public Task<String> getCurrentSessionTokenAsync() { return getAsync(false).onSuccess(new Continuation<ParseUser, String>() { @Override public String then(Task<ParseUser> task) { ParseUser user = task.getResult(); return user != null ? user.getSessionToken() : null; } }); } 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<String> getCurrentSessionTokenAsync() { return getAsync(false).onSuccess(new Continuation<ParseUser, String>() { @Override public String then(Task<ParseUser> task) { ParseUser user = task.getResult(); return user != null ? user.getSessionToken() : null; } }); } 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);  }