### Question:
SleepSoundsInteractor extends ScopedValueInteractor<SleepSoundsStateDevice> { public Observable<Boolean> hasSensePaired() { return apiService.registeredDevices() .flatMap(SleepSoundsInteractor.this::hasSensePaired); }  @Nullable @Override Bundle onSaveState(); Observable<VoidResponse> play(final @NonNull SleepSoundActionPlay actionPlay); Observable<VoidResponse> stop(final @NonNull SleepSoundActionStop actionStop); Observable<Boolean> hasSensePaired(); final InteractorSubject<SleepSoundsStateDevice> combinedState; }### Answer:
@Test public void hasSensePaired() throws Exception { final ArrayList<SenseDevice> senseDeviceList = new ArrayList<>(1); senseDeviceList.add(createSense(DateTime.now())); final Devices devicesList = new Devices(senseDeviceList, new ArrayList<>(0)); final Boolean result = Sync.wrap(sleepSoundsInteractor.hasSensePaired(devicesList)).last(); assertThat(result, equalTo(true)); senseDeviceList.clear(); senseDeviceList.add(createSense(DateTime.now().minusMinutes(30))); final Boolean resultWithMissingSense = Sync.wrap(sleepSoundsInteractor.hasSensePaired(devicesList)).last(); assertThat(resultWithMissingSense, equalTo(true)); }
@Test public void hasNoSensePaired() throws Exception { final ArrayList<SenseDevice> senseDeviceList = new ArrayList<>(0); final Devices devicesList = new Devices(senseDeviceList, new ArrayList<>(0)); Sync.wrap(sleepSoundsInteractor.hasSensePaired(null)).assertThrows(SenseRequiredException.class); Sync.wrap(sleepSoundsInteractor.hasSensePaired(devicesList)).assertThrows(SenseRequiredException.class); }