### Question:
NotificationSettingsInteractor extends ValueInteractor<ArrayList<NotificationSetting>> { public Observable<VoidResponse> enableAll() { return latest().map(this::enableAll) .flatMap(this::updateNotificationSettings); }  Observable<VoidResponse> updateNotificationSettings(@NonNull final List<NotificationSetting> settings); Observable<VoidResponse> enableAll(); Observable<VoidResponse> disableAll(); boolean updateIfInvalid(); final InteractorSubject<ArrayList<NotificationSetting>> notificationSettings; }### Answer:
@Test public void enableAll() throws Exception { final ArrayList<NotificationSetting> list = new ArrayList<>(2); list.add(create(false)); list.add(create(false)); list.add(create(false)); notificationSettingsInteractor.notificationSettings.onNext(list); Sync.last(notificationSettingsInteractor.enableAll()); for(final NotificationSetting notificationSetting : list) { assertThat(notificationSetting.isEnabled(), equalTo(true)); } }
@Test public void throwInvalidException() throws Exception { notificationSettingsInteractor.notificationSettings.onNext(null); Sync.wrap(notificationSettingsInteractor.enableAll()) .assertThrows(NotificationSettingsInteractor.InvalidException.class); notificationSettingsInteractor.notificationSettings.onNext(new ArrayList<>()); Sync.wrap(notificationSettingsInteractor.enableAll()) .assertThrows(NotificationSettingsInteractor.InvalidException.class); }