ExifHelper { DataImageLocation updateExifData(@Nullable InputStream originalImageInputStream, @NonNull String resizedImagePath) { if (originalImageInputStream != null) { try { ExifInterface originalImageExif = new ExifInterface(originalImageInputStream); ExifInterface newImageExif = new ExifInterface(resizedImagePath); copyOrientationInformation(originalImageExif, newImageExif); copyGpsInformation(originalImageExif, newImageExif); return extractGpsData(newImageExif); } catch (IOException e) { Timber.e(e); } } return new DataImageLocation(null, null, 0); } @Inject  ExifHelper();   }
@Test public void updateExifDataShouldReturnFalseForNullInputStream() { ExifHelper helper = new ExifHelper(); DataImageLocation location = helper.updateExifData(null, ""); assertNull(location.getLatitude()); assertNull(location.getLongitude()); }
@Test public void updateExifDataShouldReturnFalseForInvalidFile() throws IOException { ExifHelper helper = new ExifHelper(); File file = File.createTempFile("abc", ".txt"); DataImageLocation location = helper.updateExifData(mockInputStrem, file.getAbsolutePath()); assertNull(location.getLatitude()); assertNull(location.getLongitude()); }