### Question:
Utils { public static Uri getUriForBaseFile( @NonNull Context context, @NonNull HybridFileParcelable baseFile) { switch (baseFile.getMode()) { case FILE: case ROOT: if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return FileProvider.getUriForFile( context, context.getPackageName(), new File(baseFile.getPath())); } else { return Uri.fromFile(new File(baseFile.getPath())); } case OTG: return OTGUtil.getDocumentFile(baseFile.getPath(), context, true).getUri(); case SMB: case DROPBOX: case GDRIVE: case ONEDRIVE: case BOX: Toast.makeText(context, context.getString(R.string.smb_launch_error), Toast.LENGTH_LONG) .show(); return null; default: return null; } }  static float clamp(float min, float max, float value); static float getViewRawY(View view); static void setTint(Context context, CheckBox box, int color); static String getDate(@NonNull Context c, long f); @SuppressWarnings("deprecation") static int getColor(Context c, @ColorRes int color); static int dpToPx(Context c, int dp); static String differenceStrings(String str1, String str2); static void disableScreenRotation(@NonNull Activity activity); static void enableScreenRotation(@NonNull Activity activity); static boolean isDeviceInLandScape(Activity activity); static String sanitizeInput(String input); static Uri getUriForBaseFile(
      @NonNull Context context, @NonNull HybridFileParcelable baseFile); static int nthToLastCharIndex(int elementNumber, String str, char element); static String formatTimer(long timerInSeconds); @TargetApi(Build.VERSION_CODES.N) static File getVolumeDirectory(StorageVolume volume); static boolean isNullOrEmpty(final Collection<?> list); static boolean isNullOrEmpty(final String string); static void invalidateFab(
      MainActivity mainActivity, @Nullable Runnable callback, boolean open); static Snackbar showThemedSnackbar(
      MainActivity mainActivity,
      CharSequence text,
      int length,
      @StringRes int actionTextId,
      Runnable actionCallback);  }### Answer:
@Test public void testGetUriForBaseFile() { HybridFileParcelable file = new HybridFileParcelable("/storage/emulated/0/test.txt"); for (OpenMode m : new OpenMode[] {OpenMode.FILE, OpenMode.ROOT}) { file.setMode(m); Uri uri = Utils.getUriForBaseFile(ApplicationProvider.getApplicationContext(), file); if (Build.VERSION.SDK_INT < N) { assertEquals("file: } else { assertEquals( "content: + ApplicationProvider.getApplicationContext().getPackageName() + "/storage_root/storage/emulated/0/test.txt", uri.toString()); } } for (OpenMode m : new OpenMode[] { OpenMode.DROPBOX, OpenMode.GDRIVE, OpenMode.ONEDRIVE, OpenMode.SMB, OpenMode.BOX }) { file = new HybridFileParcelable("/foo/bar/test.txt"); file.setMode(m); assertNull(Utils.getUriForBaseFile(ApplicationProvider.getApplicationContext(), file)); assertEquals( ApplicationProvider.getApplicationContext().getString(R.string.smb_launch_error), ShadowToast.getTextOfLatestToast()); } file.setMode(OpenMode.CUSTOM); assertNull(Utils.getUriForBaseFile(ApplicationProvider.getApplicationContext(), file)); }