CameraParametersHelper { static boolean isFlashModeSupported(@NonNull String flashMode, @NonNull Camera camera) { List<String> supportedFlashModes = camera.getParameters().getSupportedFlashModes(); return supportedFlashModes != null && supportedFlashModes.contains(flashMode); } private  CameraParametersHelper();   }
@Test public void should_verifyThatFlashMode_isSupported() { when(mParameters.getSupportedFlashModes()) .thenReturn(Arrays.asList(Camera.Parameters.FLASH_MODE_AUTO, Camera.Parameters.FLASH_MODE_TORCH)); boolean isSupported = CameraParametersHelper.isFlashModeSupported( Camera.Parameters.FLASH_MODE_AUTO, mCamera); assertThat(isSupported).isTrue(); }
@Test public void should_verifyThatFlashMode_isNotSupported() { when(mParameters.getSupportedFlashModes()) .thenReturn(Collections.singletonList(Camera.Parameters.FLASH_MODE_AUTO)); boolean isSupported = CameraParametersHelper.isFlashModeSupported( Camera.Parameters.FLASH_MODE_TORCH, mCamera); assertThat(isSupported).isFalse(); }