### Question:
OfflineQueryController extends AbstractQueryController { @Override public <T extends ParseObject> Task<Integer> countAsync( ParseQuery.State<T> state, ParseUser user, Task<Void> cancellationToken) { if (state.isFromLocalDatastore()) { return offlineStore.countFromPinAsync(state.pinName(), state, user); } else { return networkController.countAsync(state, user, cancellationToken); } } OfflineQueryController(OfflineStore store, ParseQueryController network); @Override Task<List<T>> findAsync(
      ParseQuery.State<T> state,
      ParseUser user,
      Task<Void> cancellationToken); @Override Task<Integer> countAsync(
      ParseQuery.State<T> state,
      ParseUser user,
      Task<Void> cancellationToken);  }### Answer:
@Test public void testCountFromNetwork() { TestNetworkQueryController networkController = new TestNetworkQueryController(); OfflineQueryController controller = new OfflineQueryController(null, networkController); ParseQuery.State<ParseObject> state = new ParseQuery.State.Builder<>("TestObject") .build(); controller.countAsync(state, null, null); networkController.verifyCount(); }
@Test public void testCountFromLDS() { Parse.enableLocalDatastore(null); TestOfflineStore offlineStore = new TestOfflineStore(); OfflineQueryController controller = new OfflineQueryController(offlineStore, null); ParseQuery.State<ParseObject> state = new ParseQuery.State.Builder<>("TestObject") .fromLocalDatastore() .build(); controller.countAsync(state, null, null); offlineStore.verifyCount(); }