### Question:
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) throws Exception { 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();  }### Answer:
@Test public void testDeleteAsync() throws Exception { OfflineStore lds = mock(OfflineStore.class); when(lds.unpinAllObjectsAsync(anyString())).thenReturn(Task.<Void>forResult(null)); 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); ParseTaskUtils.wait(store.deleteAsync()); verify(legacy, times(1)).deleteAsync(); verify(lds, times(1)).unpinAllObjectsAsync(PIN_NAME); }
@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(); }