@Test
public void testSavePhotoAndCompress() throws Exception {

    Bitmap bitmap = mock(Bitmap.class);
    File file = new File(photoCaptureHelper.getDir(), "random_file.jpg");
    OutputStream out = mock(OutputStream.class);
    doReturn(out).when(photoCaptureHelper).getCipherOutputStream(eq(file), anyString());
    doReturn(mock(User.class)).when(application).getCurrentUser();
    photoCaptureHelper.save(bitmap, "random_file", QUALITY, "key");
    verify(bitmap).compress(Bitmap.CompressFormat.JPEG, 85, out);
    verify(out).close();
}