@Test public void toCaptureCallback_withComboCameraCallback() { CameraCaptureCallback cameraCallback1 = Mockito.mock(CameraCaptureCallback.class); CameraCaptureCallback cameraCallback2 = Mockito.mock(CameraCaptureCallback.class); CaptureCallback cameraCallback3 = Mockito.mock(CaptureCallback.class); CaptureCallback callback = CaptureCallbackConverter.toCaptureCallback( CameraCaptureCallbacks.createComboCallback( cameraCallback1, CameraCaptureCallbacks.createComboCallback( cameraCallback2, CaptureCallbackContainer.create(cameraCallback3)))); callback.onCaptureCompleted(mCameraCaptureSession, mCaptureRequest, mCaptureResult); verify(cameraCallback1, times(1)).onCaptureCompleted(any(CameraCaptureResult.class)); verify(cameraCallback2, times(1)).onCaptureCompleted(any(CameraCaptureResult.class)); verify(cameraCallback3, times(1)).onCaptureCompleted(any(CameraCaptureSession.class), any( CaptureRequest.class), any(TotalCaptureResult.class)); }
static CaptureCallback toCaptureCallback(CameraCaptureCallback cameraCaptureCallback) { if (cameraCaptureCallback == null) { return null; } List<CaptureCallback> list = new ArrayList<>(); toCaptureCallback(cameraCaptureCallback, list); return list.size() == 1 ? list.get(0) : Camera2CaptureCallbacks.createComboCallback(list); }
CaptureCallbackConverter { static CaptureCallback toCaptureCallback(CameraCaptureCallback cameraCaptureCallback) { if (cameraCaptureCallback == null) { return null; } List<CaptureCallback> list = new ArrayList<>(); toCaptureCallback(cameraCaptureCallback, list); return list.size() == 1 ? list.get(0) : Camera2CaptureCallbacks.createComboCallback(list); } }
CaptureCallbackConverter { static CaptureCallback toCaptureCallback(CameraCaptureCallback cameraCaptureCallback) { if (cameraCaptureCallback == null) { return null; } List<CaptureCallback> list = new ArrayList<>(); toCaptureCallback(cameraCaptureCallback, list); return list.size() == 1 ? list.get(0) : Camera2CaptureCallbacks.createComboCallback(list); } private  CaptureCallbackConverter(); }
CaptureCallbackConverter { static CaptureCallback toCaptureCallback(CameraCaptureCallback cameraCaptureCallback) { if (cameraCaptureCallback == null) { return null; } List<CaptureCallback> list = new ArrayList<>(); toCaptureCallback(cameraCaptureCallback, list); return list.size() == 1 ? list.get(0) : Camera2CaptureCallbacks.createComboCallback(list); } private  CaptureCallbackConverter();  }
CaptureCallbackConverter { static CaptureCallback toCaptureCallback(CameraCaptureCallback cameraCaptureCallback) { if (cameraCaptureCallback == null) { return null; } List<CaptureCallback> list = new ArrayList<>(); toCaptureCallback(cameraCaptureCallback, list); return list.size() == 1 ? list.get(0) : Camera2CaptureCallbacks.createComboCallback(list); } private  CaptureCallbackConverter();   }