FileObjectStore implements ParseObjectStore<T> { @Override public Task<T> getAsync() { return Task.call(new Callable<T>() { @Override public T call() { if (!file.exists()) { return null; } return getFromDisk(coder, file, ParseObject.State.newBuilder(className)); } }, 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 testGetAsync() throws Exception { File file = new File(temporaryFolder.getRoot(), "test"); JSONObject json = new JSONObject(); ParseFileUtils.writeJSONObjectToFile(file, json); ParseUser.State.Builder builder = new ParseUser.State.Builder(); builder.put("foo", "bar"); ParseUserCurrentCoder coder = mock(ParseUserCurrentCoder.class); when(coder.decode(any(ParseUser.State.Builder.class), any(JSONObject.class), any(ParseDecoder.class))) .thenReturn(builder); FileObjectStore<ParseUser> store = new FileObjectStore<>(ParseUser.class, file, coder); ParseUser user = ParseTaskUtils.wait(store.getAsync()); assertEquals("bar", user.getState().get("foo")); }