@Test public void testDeleteAsyncFailure() throws Exception { OfflineStore lds = mock(OfflineStore.class); when(lds.unpinAllObjectsAsync(anyString())) .thenReturn(Task.<Void>forError(new RuntimeException("failure"))); Parse.setLocalDatastore(lds); @SuppressWarnings("unchecked") ParseObjectStore<ParseUser> legacy = mock(ParseObjectStore.class); when(legacy.deleteAsync()).thenReturn(Task.<Void>forResult(null)); OfflineObjectStore<ParseUser> store = new OfflineObjectStore<>(ParseUser.class, PIN_NAME, legacy); thrown.expect(RuntimeException.class); ParseTaskUtils.wait(store.deleteAsync()); verify(legacy, times(1)).deleteAsync(); }
@Override public Task<Void> deleteAsync() { final Task<Void> ldsTask = ParseObject.unpinAllInBackground(pinName); return Task.whenAll(Arrays.asList( legacy.deleteAsync(), ldsTask )).continueWithTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) { return ldsTask; } }); }
OfflineObjectStore implements ParseObjectStore<T> { @Override public Task<Void> deleteAsync() { final Task<Void> ldsTask = ParseObject.unpinAllInBackground(pinName); return Task.whenAll(Arrays.asList( legacy.deleteAsync(), ldsTask )).continueWithTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) { return ldsTask; } }); } }
OfflineObjectStore implements ParseObjectStore<T> { @Override public Task<Void> deleteAsync() { final Task<Void> ldsTask = ParseObject.unpinAllInBackground(pinName); return Task.whenAll(Arrays.asList( legacy.deleteAsync(), ldsTask )).continueWithTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) { return ldsTask; } }); } OfflineObjectStore(Class<T> clazz, String pinName, ParseObjectStore<T> legacy);  OfflineObjectStore(String className, String pinName, ParseObjectStore<T> legacy); }
OfflineObjectStore implements ParseObjectStore<T> { @Override public Task<Void> deleteAsync() { final Task<Void> ldsTask = ParseObject.unpinAllInBackground(pinName); return Task.whenAll(Arrays.asList( legacy.deleteAsync(), ldsTask )).continueWithTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) { return ldsTask; } }); } OfflineObjectStore(Class<T> clazz, String pinName, ParseObjectStore<T> legacy);  OfflineObjectStore(String className, String pinName, ParseObjectStore<T> legacy); @Override Task<Void> setAsync(final T object); @Override Task<T> getAsync(); @Override Task<Boolean> existsAsync(); @Override Task<Void> deleteAsync(); }
OfflineObjectStore implements ParseObjectStore<T> { @Override public Task<Void> deleteAsync() { final Task<Void> ldsTask = ParseObject.unpinAllInBackground(pinName); return Task.whenAll(Arrays.asList( legacy.deleteAsync(), ldsTask )).continueWithTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) { return ldsTask; } }); } OfflineObjectStore(Class<T> clazz, String pinName, ParseObjectStore<T> legacy);  OfflineObjectStore(String className, String pinName, ParseObjectStore<T> legacy); @Override Task<Void> setAsync(final T object); @Override Task<T> getAsync(); @Override Task<Boolean> existsAsync(); @Override Task<Void> deleteAsync();  }