CategoryProvider extends FDroidProvider { public static Uri getCategoryUri(String categoryName) { return getContentUri() .buildUpon() .appendPath(PATH_CATEGORY_NAME) .appendPath(categoryName) .build(); }  static Uri getAllCategories(); static Uri getCategoryUri(String categoryName); static String getAuthority(); @Override Cursor query(@NonNull Uri uri, String[] projection,
                        String customSelection, String[] selectionArgs, String sortOrder); @Override int delete(@NonNull Uri uri, String where, String[] whereArgs); @Override Uri insert(@NonNull Uri uri, ContentValues values); @Override int update(@NonNull Uri uri, ContentValues values, String where, String[] whereArgs);  }
@Test public void queryAppsInCategories() { insertAppWithCategory("com.dog", "Dog", "Animal"); insertAppWithCategory("com.cat", "Cat", "Animal"); insertAppWithCategory("com.crow", "Crow", "Animal,Bird"); insertAppWithCategory("com.chicken", "Chicken", "Animal,Bird,Food"); insertAppWithCategory("com.bird-statue", "Bird Statue", "Bird,Mineral"); insertAppWithCategory("com.rock", "Rock", "Mineral"); insertAppWithCategory("com.banana", "Banana", "Food"); assertPackagesInCategory("Animal", new String[]{ "com.dog", "com.cat", "com.crow", "com.chicken", }); assertPackagesInCategory("animal", new String[]{ "com.dog", "com.cat", "com.crow", "com.chicken", }); assertPackagesInCategory("Bird", new String[]{ "com.crow", "com.chicken", "com.bird-statue", }); assertPackagesInCategory("Food", new String[]{ "com.chicken", "com.banana", }); assertPackagesInCategory("Mineral", new String[]{ "com.rock", "com.bird-statue", }); assertNoPackagesInUri(AppProvider.getCategoryUri("Not a category")); }