### Question:
CachedCurrentUserController implements ParseCurrentUserController { @Override public Task<Void> setAsync(final ParseUser user) { return taskQueue.enqueue(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> toAwait) throws Exception { return toAwait.continueWithTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) throws Exception { ParseUser oldCurrentUser; synchronized (mutex) { oldCurrentUser = currentUser; } if (oldCurrentUser != null && oldCurrentUser != user) { return oldCurrentUser.logOutAsync(false).continueWith(new Continuation<Void, Void>() { @Override public Void then(Task<Void> task) throws Exception { return null; } }); } return task; } }).onSuccessTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) throws Exception { user.setIsCurrentUser(true); return user.synchronizeAllAuthDataAsync(); } }).onSuccessTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) throws Exception { return store.setAsync(user).continueWith(new Continuation<Void, Void>() { @Override public Void then(Task<Void> task) throws Exception { synchronized (mutex) { currentUserMatchesDisk = !task.isFaulted(); currentUser = user; } return 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);  }### Answer:
@Test public void testSetAsyncWithNoInMemoryCurrentUser() throws Exception { ParseUser.State state = new ParseUser.State.Builder() .put("key", "value") .build(); ParseUser currentUser = ParseObject.from(state); ParseObjectStore<ParseUser> store = (ParseObjectStore<ParseUser>) mock(ParseObjectStore.class); when(store.setAsync(currentUser)).thenReturn(Task.<Void>forResult(null)); CachedCurrentUserController controller = new CachedCurrentUserController(store); ParseTaskUtils.wait(controller.setAsync(currentUser)); verify(store, times(1)).setAsync(currentUser); assertTrue(currentUser.isCurrentUser()); assertSame(currentUser, controller.currentUser); assertTrue(controller.currentUserMatchesDisk); }