### Question:
CachedCurrentInstallationController implements ParseCurrentInstallationController { @Override public Task<Boolean> existsAsync() { synchronized (mutex) { if (currentInstallation != 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(); } }); } }); } CachedCurrentInstallationController(
      ParseObjectStore<ParseInstallation> store, InstallationId installationId); @Override Task<Void> setAsync(final ParseInstallation installation); @Override Task<ParseInstallation> getAsync(); @Override Task<Boolean> existsAsync(); @Override void clearFromMemory(); @Override void clearFromDisk(); @Override boolean isCurrent(ParseInstallation installation);  }### Answer:
@Test public void testExistAsyncFromMemory() throws Exception { CachedCurrentInstallationController controller = new CachedCurrentInstallationController(null, null); controller.currentInstallation = mock(ParseInstallation.class); assertTrue(ParseTaskUtils.wait(controller.existsAsync())); }
@Test public void testExistAsyncFromStore() throws Exception { ParseObjectStore<ParseInstallation> store = mock(ParseObjectStore.class); when(store.existsAsync()).thenReturn(Task.forResult(true)); CachedCurrentInstallationController controller = new CachedCurrentInstallationController(store, null); assertTrue(ParseTaskUtils.wait(controller.existsAsync())); verify(store, times(1)).existsAsync(); }