### Question:
CheckAvailabilityRoutine { public boolean isAvailable() { return selectedLensPosition() != null; } CheckAvailabilityRoutine(CameraDevice cameraDevice,
                                    SelectorFunction<Collection<LensPosition>, LensPosition> lensPositionSelector); boolean isAvailable();  }### Answer:
@Test public void available() throws Exception { givenLensPositionsAreReturned(); given(lensPositionSelector.select(LENS_POSITIONS)) .willReturn(LensPosition.FRONT); boolean result = testee.isAvailable(); assertTrue(result); }
@Test public void notAvailable() throws Exception { givenLensPositionsAreReturned(); given(lensPositionSelector.select(LENS_POSITIONS)) .willReturn(null); boolean result = testee.isAvailable(); assertFalse(result); }