@@ -0,0 +1,3187 @@
+/*%0A * Copyright 2019 Immutables Authors and Contributors%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *  http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage org.immutables.criteria.repository.reactive;%0A%0Aimport io.reactivex.Flowable;%0Aimport org.immutables.criteria.backend.NonUniqueResultException;%0Aimport org.immutables.criteria.expression.Query;%0Aimport org.immutables.criteria.repository.FakeBackend;%0Aimport org.immutables.criteria.typemodel.TypeHolder;%0Aimport org.junit.jupiter.api.Assertions;%0Aimport org.junit.jupiter.api.Test;%0A%0Aimport static org.immutables.check.Checkers.check;%0A%0A/**%0A * Check that correct exceptions are thrown by %7B@link ReactiveFetcher%7D%0A */%0Aclass ReactiveFetcherDelegateTest %7B%0A%0A  @Test%0A  void fetch() %7B%0A    check(Flowable.fromPublisher(create().fetch()).toList().blockingGet()).isEmpty();%0A    check(Flowable.fromPublisher(create(%22one%22).fetch()).toList().blockingGet()).isOf(%22one%22);%0A    check(Flowable.fromPublisher(create(%22one%22, %22two%22).fetch()).toList().blockingGet()).isOf(%22one%22, %22two%22);%0A    check(Flowable.fromPublisher(create(%22one%22, %22two%22, %22three%22).fetch()).toList().blockingGet()).isOf(%22one%22, %22two%22, %22three%22);%0A  %7D%0A%0A  @Test%0A  void one() %7B%0A    Assertions.assertThrows(NonUniqueResultException.class, () -%3E %7B%0A      // empty%0A      Flowable.fromPublisher(create().one()).toList().blockingGet();%0A    %7D);%0A%0A    // one%0A    check(Flowable.fromPublisher(create(%22one%22).one()).toList().blockingGet()).hasContentInAnyOrder(%22one%22);%0A%0A    Assertions.assertThrows(NonUniqueResultException.class, () -%3E %7B%0A      // two%0A      Flowable.fromPublisher(create(%22one%22, %22two%22).one()).toList().blockingGet();%0A    %7D);%0A  %7D%0A%0A  @Test%0A  void oneOrNone() %7B%0A    check(Flowable.fromPublisher(create().oneOrNone()).toList().blockingGet()).isEmpty();%0A    check(Flowable.fromPublisher(create(%22one%22).oneOrNone()).toList().blockingGet()).hasContentInAnyOrder(%22one%22);%0A    Assertions.assertThrows(NonUniqueResultException.class, () -%3E %7B%0A      // two%0A      Flowable.fromPublisher(create(%22one%22, %22two%22).one()).toList().blockingGet();%0A    %7D);%0A  %7D%0A%0A  @Test%0A  void exists() %7B%0A    check(Flowable.fromPublisher(create().exists()).toList().blockingGet()).isOf(false);%0A    check(Flowable.fromPublisher(create(%22one%22).exists()).toList().blockingGet()).isOf(true);%0A    check(Flowable.fromPublisher(create(%22one%22, %22two%22).exists()).toList().blockingGet()).isOf(true);%0A    check(Flowable.fromPublisher(create(%22one%22, %22two%22, %22three%22).exists()).toList().blockingGet()).isOf(true);%0A  %7D%0A%0A  private static ReactiveFetcher%3CString%3E create(String ... values) %7B%0A    FakeBackend backend = new FakeBackend(Flowable.fromArray(values));%0A    return ReactiveFetcherDelegate.of(Query.of(TypeHolder.StringHolder.class), backend.open(TypeHolder.StringHolder.class));%0A  %7D%0A%7D%0A

Add simple tests for ReactiveFetcher