FileObjectStore implements ParseObjectStore<T> { @Override public Task<Void> setAsync(final T object) { return Task.call(new Callable<Void>() { @Override public Void call() { saveToDisk(coder, object, file); return null; } }, ParseExecutors.io()); } FileObjectStore(Class<T> clazz, File file, ParseObjectCurrentCoder coder);  FileObjectStore(String className, File file, ParseObjectCurrentCoder coder); @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 { File file = new File(temporaryFolder.getRoot(), "test"); ParseUser.State state = mock(ParseUser.State.class); JSONObject json = new JSONObject(); json.put("foo", "bar"); ParseUserCurrentCoder coder = mock(ParseUserCurrentCoder.class); when(coder.encode(eq(state), (ParseOperationSet) isNull(), any(PointerEncoder.class))) .thenReturn(json); FileObjectStore<ParseUser> store = new FileObjectStore<>(ParseUser.class, file, coder); ParseUser user = mock(ParseUser.class); when(user.getState()).thenReturn(state); ParseTaskUtils.wait(store.setAsync(user)); JSONObject jsonAgain = ParseFileUtils.readFileToJSONObject(file); assertEquals(json, jsonAgain, JSONCompareMode.STRICT); }