NCMBQuery { public List<T> find () throws NCMBException { if (mClassName.equals("user")) { NCMBUserService userServ = (NCMBUserService) NCMB.factory(NCMB.ServiceType.USER); return (List<T>) userServ.searchUser(getConditions()); } else if (mClassName.equals("role")) { NCMBRoleService roleServ = (NCMBRoleService) NCMB.factory(NCMB.ServiceType.ROLE); return (List<T>) roleServ.searchRole(getConditions()); } else if (mClassName.equals("push")) { NCMBPushService pushServ = (NCMBPushService) NCMB.factory(NCMB.ServiceType.PUSH); return (List<T>) pushServ.searchPush(getConditions()); } else if (mClassName.equals("installation")){ NCMBInstallationService installationServ = (NCMBInstallationService)NCMB.factory(NCMB.ServiceType.INSTALLATION); return (List<T>)installationServ.searchInstallation(getConditions()); } else if (mClassName.equals("file")){ NCMBFileService fileServ = (NCMBFileService)NCMB.factory(NCMB.ServiceType.FILE); return (List<T>)fileServ.searchFile(getConditions()); } else { NCMBObjectService objServ = (NCMBObjectService)NCMB.factory(NCMB.ServiceType.OBJECT); return objServ.searchObject(mClassName, getConditions()); } } 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 find_valid_class() throws Exception { NCMBQuery<NCMBObject> query = new NCMBQuery<>("TestClass"); List<NCMBObject> result = query.find(); Assert.assertEquals("8FgKqFlH8dZRDrBJ", result.get(0).getObjectId()); }