### Question:
CameraSelector { @NonNull public String findCameraId(LensPosition lensPosition) { try { return getCameraIdUnsafe(lensPosition); } catch (CameraAccessException e) { throw new CameraException(e); } } CameraSelector(android.hardware.camera2.CameraManager manager); @NonNull String findCameraId(LensPosition lensPosition);  }### Answer:
@Test(expected = CameraException.class) public void cameraNotAvailable() throws Exception { given(manager.getCameraIdList()) .willThrow(new CameraAccessException(CAMERA_ERROR)); testee.findCameraId(LensPosition.EXTERNAL); }
@Test(expected = CameraException.class) public void noCameraFound() throws Exception { given(manager.getCameraIdList()) .willReturn(new String[]{"0"}); testee.findCameraId(LensPosition.EXTERNAL); }
@Test public void getFrontCamera() throws Exception { given(manager.getCameraIdList()) .willReturn(new String[]{"0", "1"}); String cameraId = testee.findCameraId(LensPosition.FRONT); assertEquals("1", cameraId); }