@Test public void testExistAsyncFromMemory() throws Exception { CachedCurrentInstallationController controller = new CachedCurrentInstallationController(null, null); controller.currentInstallation = mock(ParseInstallation.class); assertTrue(ParseTaskUtils.wait(controller.existsAsync())); }
@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) { return toAwait.continueWithTask(new Continuation<Void, Task<Boolean>>() { @Override public Task<Boolean> then(Task<Void> task) { return store.existsAsync(); } }); } }); }
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) { return toAwait.continueWithTask(new Continuation<Void, Task<Boolean>>() { @Override public Task<Boolean> then(Task<Void> task) { return store.existsAsync(); } }); } }); } }
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) { return toAwait.continueWithTask(new Continuation<Void, Task<Boolean>>() { @Override public Task<Boolean> then(Task<Void> task) { return store.existsAsync(); } }); } }); } CachedCurrentInstallationController(
            ParseObjectStore<ParseInstallation> store, InstallationId installationId); }
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) { return toAwait.continueWithTask(new Continuation<Void, Task<Boolean>>() { @Override public Task<Boolean> then(Task<Void> task) { 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); }
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) { return toAwait.continueWithTask(new Continuation<Void, Task<Boolean>>() { @Override public Task<Boolean> then(Task<Void> task) { 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);  }