MediaResolverHelper { @Nullable public InputStream getInputStreamFromUri(@NonNull Uri uri) { try { return context.getContentResolver().openInputStream(uri); } catch (FileNotFoundException e) { Timber.e(e, "Error getting inputStream for: " + uri.toString()); return null; } } @Inject  MediaResolverHelper(Context context, ExifHelper exifHelper, FileHelper fileHelper); @Nullable InputStream getInputStreamFromUri(@NonNull Uri uri); @Nullable ParcelFileDescriptor openFileDescriptor(@NonNull Uri uri); boolean removeDuplicateImage(@NonNull Uri uri);  }
@Test public void getInputStreamFromUriShouldReturnNullWhenUriNotFound() throws FileNotFoundException { when(mockContentResolver.openInputStream(any(Uri.class))) .thenThrow(FileNotFoundException.class); when(mockUri.toString()).thenReturn(""); InputStream inputStream = helper.getInputStreamFromUri(mockUri); assertNull(inputStream); }