OfflineObjectStore implements ParseObjectStore<T> { @Override public Task<Void> setAsync(final T object) { return ParseObject.unpinAllInBackground(pinName).continueWithTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) { return object.pinInBackground(pinName, false); } }); } 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();  }
@Test public void testSetAsync() throws Exception { OfflineStore lds = mock(OfflineStore.class); when(lds.unpinAllObjectsAsync(anyString())).thenReturn(Task.<Void>forResult(null)); when(lds.pinAllObjectsAsync(anyString(), anyList(), anyBoolean())) .thenReturn(Task.forResult(null)); Parse.setLocalDatastore(lds); OfflineObjectStore<ParseUser> store = new OfflineObjectStore<>(ParseUser.class, PIN_NAME, null); ParseUser user = mock(ParseUser.class); ParseTaskUtils.wait(store.setAsync(user)); verify(lds, times(1)).unpinAllObjectsAsync(PIN_NAME); verify(user, times(1)).pinInBackground(PIN_NAME, false); }