### Question:
FileProvider extends ContentProvider { private static File buildPath(File base, String... segments) { File cur = base; for (String segment : segments) { if (segment != null) { cur = new File(cur, segment); } } return cur; }  @Override boolean onCreate(); @Override void attachInfo(@NonNull Context context, @NonNull ProviderInfo info); static Uri getUriForFile(@NonNull Context context, @NonNull String authority,
            @NonNull File file); @Override Cursor query(@NonNull Uri uri, @Nullable String[] projection, @Nullable String selection,
            @Nullable String[] selectionArgs,
            @Nullable String sortOrder); @Override String getType(@NonNull Uri uri); @Override Uri insert(@NonNull Uri uri, ContentValues values); @Override int update(@NonNull Uri uri, ContentValues values, @Nullable String selection,
            @Nullable String[] selectionArgs); @Override int delete(@NonNull Uri uri, @Nullable String selection,
            @Nullable String[] selectionArgs); @Override ParcelFileDescriptor openFile(@NonNull Uri uri, @NonNull String mode);  }### Answer:
@Test public void testStrategyFileSimple() throws Exception { final SimplePathStrategy strat = new SimplePathStrategy("authority"); strat.addRoot("tag", mContext.getFilesDir()); File expectedRoot = mContext.getFilesDir().getCanonicalFile(); File file = buildPath(expectedRoot, "file.test"); assertEquals(file.getPath(), strat.getFileForUri(Uri.parse("content: file = buildPath(expectedRoot, "subdir", "file.test"); assertEquals(file.getPath(), strat.getFileForUri( Uri.parse("content: }
@Test public void testStrategyExtraParams() throws Exception { final SimplePathStrategy strat = new SimplePathStrategy("authority"); strat.addRoot("tag", mContext.getFilesDir()); File expectedRoot = mContext.getFilesDir().getCanonicalFile(); File file = buildPath(expectedRoot, "file.txt"); assertEquals(file.getPath(), strat.getFileForUri( Uri.parse("content: }