PhotoCaptureHelper extends CaptureHelper { public Calendar getCaptureTime() { Calendar calendar = Calendar.getInstance(); long time = application.getSharedPreferences().getLong("capture_start_time", System.currentTimeMillis()); calendar.setTimeInMillis(time); return calendar; } PhotoCaptureHelper(RapidFtrApplication context); File getTempCaptureFile(); Calendar getCaptureTime(); void setCaptureTime(); Bitmap getCapture(); void deleteCaptures(); Bitmap getDefaultThumbnail(); void savePhoto(Bitmap original, int rotationDegree, String fileNameWithoutExtension); void saveThumbnail(Bitmap original, int rotationDegree, String fileNameWithoutExtension); Bitmap loadThumbnail(String fileNameWithoutExtension); Bitmap loadPhoto(String fileNameWithoutExtension); InputStream getDecodedImageStream(String fileNameWithoutExtension); Bitmap getThumbnailOrDefault(String fileNameWithoutExtension); int getPictureRotation(); void convertPhoto(String photo, String existingKey, String newKey); static final int THUMBNAIL_WIDTH; static final int THUMBNAIL_HEIGHT; static final int JPEG_QUALITY; static final int PHOTO_WIDTH; static final int PHOTO_HEIGHT; static final int QUALITY; }
@Test public void testGetCaptureTimeFromSharedPreferences() { Calendar expected = Calendar.getInstance(); expected.setTimeInMillis(500); application.getSharedPreferences().edit().putLong("capture_start_time", 500).commit(); Calendar actual = photoCaptureHelper.getCaptureTime(); assertThat(actual, equalTo(expected)); }