NCMBQuery { public int count () throws NCMBException { int iSetLimitNumber = limitNumber; countFlag = true; limitNumber = 1; NCMBObjectService objServ = (NCMBObjectService)NCMB.factory(NCMB.ServiceType.OBJECT); JSONObject countConditions = getConditions(); limitNumber = iSetLimitNumber; countFlag = false; return objServ.countObject(mClassName, countConditions); } NCMBQuery(String className); List<T> find(); void findInBackground(final FindCallback<T> callback); JSONObject getConditions(); void whereEqualTo(String key, Object value); void whereNotEqualTo(String key, Object value); void whereLessThan(String key, Object value); void whereGreaterThan(String key, Object value); void whereLessThanOrEqualTo(String key, Object value); void whereGreaterThanOrEqualTo(String key, Object value); void whereContainedIn(String key, Collection<? extends Object> objects); void whereNotContainedIn(String key, Collection<? extends Object> objects); void whereExists(String key); void whereDoesNotExists(String key); void whereContainedInArray(String key, Collection<? extends Object> elements); void whereNotContainedInArray(String key, Collection<? extends Object> elements); void whereContainsAll(String key, Collection<? extends Object> elements); void or(Collection<NCMBQuery> queries); void whereMatchesKeyInQuery(String key, String inQueryKey, NCMBQuery inQuery); void whereMatchesQuery(String key, NCMBQuery inQuery); void whereRelatedTo(NCMBObject parent, String key); void whereWithinGeoBox(String key, Location southwest, Location northeast); void whereWithinKilometers(String key, Location center, double distance); void whereWithinMiles(String key, Location center, int distance); void whereWithinRadians(String key, Location center, int distance); void setLimit(int number); void setSkip(int number); void setIncludeKey(String key); void addOrderByAscending(String key); void addOrderByDescending(String key); void deleteOrder(String key); int count(); void countInBackground(CountCallback callback);  }
@Test public void count_file() throws Exception { NCMBQuery<NCMBFile> query = NCMBFile.getQuery(); int result = query.count(); Assert.assertEquals(result, 50); }