@Test public void testFetchIncludesNull() throws ParseException { OfflineStore store = mock(OfflineStore.class); when(store.fetchLocallyAsync(any(ParseObject.class), any(ParseSQLiteDatabase.class))) .thenReturn(Task.<ParseObject>forResult(null)); ParseQuery.State<ParseObject> query = new ParseQuery.State.Builder<>("TestObject") .include("foo") .build(); ParseObject object = new ParseObject("TestObject"); object.put("foo", JSONObject.NULL); ParseTaskUtils.wait(OfflineQueryLogic.fetchIncludesAsync(store, object, query, null)); verify(store, times(1)) .fetchLocallyAsync(any(ParseObject.class), any(ParseSQLiteDatabase.class)); }
static <T extends ParseObject> Task<Void> fetchIncludesAsync( final OfflineStore store, final T object, ParseQuery.State<T> state, final ParseSQLiteDatabase db) { Set<String> includes = state.includes(); Task<Void> task = Task.forResult(null); for (final String include : includes) { task = task.onSuccessTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) { return fetchIncludeAsync(store, object, include, db); } }); } return task; }
OfflineQueryLogic { static <T extends ParseObject> Task<Void> fetchIncludesAsync( final OfflineStore store, final T object, ParseQuery.State<T> state, final ParseSQLiteDatabase db) { Set<String> includes = state.includes(); Task<Void> task = Task.forResult(null); for (final String include : includes) { task = task.onSuccessTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) { return fetchIncludeAsync(store, object, include, db); } }); } return task; } }
OfflineQueryLogic { static <T extends ParseObject> Task<Void> fetchIncludesAsync( final OfflineStore store, final T object, ParseQuery.State<T> state, final ParseSQLiteDatabase db) { Set<String> includes = state.includes(); Task<Void> task = Task.forResult(null); for (final String include : includes) { task = task.onSuccessTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) { return fetchIncludeAsync(store, object, include, db); } }); } return task; } OfflineQueryLogic(OfflineStore store); }
OfflineQueryLogic { static <T extends ParseObject> Task<Void> fetchIncludesAsync( final OfflineStore store, final T object, ParseQuery.State<T> state, final ParseSQLiteDatabase db) { Set<String> includes = state.includes(); Task<Void> task = Task.forResult(null); for (final String include : includes) { task = task.onSuccessTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) { return fetchIncludeAsync(store, object, include, db); } }); } return task; } OfflineQueryLogic(OfflineStore store);  }
OfflineQueryLogic { static <T extends ParseObject> Task<Void> fetchIncludesAsync( final OfflineStore store, final T object, ParseQuery.State<T> state, final ParseSQLiteDatabase db) { Set<String> includes = state.includes(); Task<Void> task = Task.forResult(null); for (final String include : includes) { task = task.onSuccessTask(new Continuation<Void, Task<Void>>() { @Override public Task<Void> then(Task<Void> task) { return fetchIncludeAsync(store, object, include, db); } }); } return task; } OfflineQueryLogic(OfflineStore store);   }