Camera2CameraCaptureResultConverter { public static CaptureResult getCaptureResult(CameraCaptureResult cameraCaptureResult) { if (cameraCaptureResult instanceof Camera2CameraCaptureResult) { return ((Camera2CameraCaptureResult) cameraCaptureResult).getCaptureResult(); } else { return null; } } private  Camera2CameraCaptureResultConverter(); static CaptureResult getCaptureResult(CameraCaptureResult cameraCaptureResult);  }
@Test public void canRetrieveCaptureResult() { CameraCaptureResult cameraCaptureResult = new Camera2CameraCaptureResult(null, mCaptureResult); CaptureResult captureResult = Camera2CameraCaptureResultConverter.getCaptureResult( cameraCaptureResult); assertThat(captureResult).isSameInstanceAs(mCaptureResult); }
@Test public void retrieveNullIfNotCamera2CameraCaptureResult() { CameraCaptureResult cameraCaptureResult = new CameraCaptureResult.EmptyCameraCaptureResult(); CaptureResult captureResult = Camera2CameraCaptureResultConverter.getCaptureResult( cameraCaptureResult); assertThat(captureResult).isNull(); }