### Question:
CachedCurrentUserController implements ParseCurrentUserController { @Override public Task<Boolean> existsAsync() { synchronized (mutex) { if (currentUser != null) { return Task.forResult(true); } } return taskQueue.enqueue(new Continuation<Void, Task<Boolean>>() { @Override public Task<Boolean> then(Task<Void> toAwait) throws Exception { return toAwait.continueWithTask(new Continuation<Void, Task<Boolean>>() { @Override public Task<Boolean> then(Task<Void> task) throws Exception { return store.existsAsync(); } }); } }); } 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);  }### Answer:
@Test public void testExistsAsyncWithInMemoryCurrentUserSet() throws Exception { CachedCurrentUserController controller = new CachedCurrentUserController(null); controller.currentUser = new ParseUser(); assertTrue(ParseTaskUtils.wait(controller.existsAsync())); }
@Test public void testExistsAsyncWithInDiskCurrentUserSet() throws Exception { ParseObjectStore<ParseUser> store = (ParseObjectStore<ParseUser>) mock(ParseObjectStore.class); when(store.existsAsync()).thenReturn(Task.forResult(true)); CachedCurrentUserController controller = new CachedCurrentUserController(store); assertTrue(ParseTaskUtils.wait(controller.existsAsync())); }
@Test public void testExistsAsyncWithNoInMemoryAndInDiskCurrentUserSet() throws Exception { ParseObjectStore<ParseUser> store = (ParseObjectStore<ParseUser>) mock(ParseObjectStore.class); when(store.existsAsync()).thenReturn(Task.forResult(false)); CachedCurrentUserController controller = new CachedCurrentUserController(store); assertFalse(ParseTaskUtils.wait(controller.existsAsync())); }