### Question:
CapabilitiesFactory implements CapabilitiesOperator { @Override public Capabilities getCapabilities() { return new Capabilities( availableJpegSizes(), availablePreviewSizes(), availableFocusModes(), availableFlashModes(), availablePreviewFpsRanges(), availableSensorSensitivity(), false ); } CapabilitiesFactory(CameraConnection cameraConnection); @Override Capabilities getCapabilities();  }### Answer:
@Test public void supportedFlashModes_FlashAvailable() throws Exception { given(characteristics.isFlashAvailable()) .willReturn(true); given(characteristics.autoExposureModes()) .willReturn(new int[]{ CameraMetadata.CONTROL_AE_MODE_ON_ALWAYS_FLASH, CameraMetadata.CONTROL_AE_MODE_ON_AUTO_FLASH, CameraMetadata.CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE }); Capabilities capabilities = testee.getCapabilities(); assertEquals(FLASH_SET, capabilities.supportedFlashModes()); }
@Test public void supportedFlashModes_FlashNotAvailable() throws Exception { given(characteristics.isFlashAvailable()) .willReturn(false); Capabilities capabilities = testee.getCapabilities(); assertEquals( asSet(Flash.OFF), capabilities.supportedFlashModes() ); }
@Test public void supportedFocusModes() throws Exception { given(characteristics.autoFocusModes()) .willReturn( new int[]{ CameraMetadata.CONTROL_AF_MODE_OFF, CameraMetadata.CONTROL_AF_MODE_AUTO, CameraMetadata.CONTROL_AF_MODE_MACRO, CameraMetadata.CONTROL_AF_MODE_CONTINUOUS_VIDEO, CameraMetadata.CONTROL_AF_MODE_CONTINUOUS_PICTURE, CameraMetadata.CONTROL_AF_MODE_EDOF } ); Capabilities capabilities = testee.getCapabilities(); assertEquals(FOCUS_MODE_SET, capabilities.supportedFocusModes()); }
@Test public void supportedPictureSizes() throws Exception { given(characteristics.getJpegOutputSizes()) .willReturn(SIZE_SET); Capabilities capabilities = testee.getCapabilities(); assertEquals(SIZE_SET, capabilities.supportedPictureSizes()); }
@Test public void supportedPreviewSizes_Below_1080p() throws Exception { given(characteristics.getSurfaceOutputSizes()) .willReturn(asSet( new Size(1000, 1000), new Size(1080, 1920), new Size(1920, 1080), new Size(1920, 1920), new Size(1440, 1920) )); Capabilities capabilities = testee.getCapabilities(); assertEquals( asSet( new Size(1000, 1000), new Size(1920, 1080) ), capabilities.supportedPreviewSizes() ); }
@Test public void supportedPreviewFpsRanges() throws Exception { given(characteristics.getTargetFpsRanges()) .willReturn(PREVIEW_FPS_RANGE_SET); Capabilities capabilities = testee.getCapabilities(); assertEquals( PREVIEW_FPS_RANGE_SET, capabilities.supportedPreviewFpsRanges() ); }