### Question:
ConfigurePreviewStreamRoutine implements Runnable { @Override public void run() { if (frameProcessor == null) { return; } PreviewStream previewStream = cameraDevice.getPreviewStream(); previewStream.addProcessor(frameProcessor); previewStream.start(); } ConfigurePreviewStreamRoutine(CameraDevice cameraDevice,
                                         FrameProcessor frameProcessor); @Override void run();  }### Answer:
@Test public void configurePreview() throws Exception { testee.run(); InOrder inOrder = inOrder(previewStream); inOrder.verify(previewStream).addProcessor(frameProcessor); inOrder.verify(previewStream).start(); }
@Test public void noFrameProcessor() throws Exception { ConfigurePreviewStreamRoutine testee = new ConfigurePreviewStreamRoutine( cameraDevice, null ); testee.run(); verifyZeroInteractions(previewStream); }