// Path: agera/src/main/java/com/google/android/agera/Reservoirs.java
// @NonNull
// public static <T> Reservoir<T> reservoir() {
//   return reservoir(new ArrayDeque<T>());
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Reservoirs.java
// @NonNull
// public static <T> Reservoir<T> reservoirOf(
//     @SuppressWarnings("unused") @Nullable final Class<T> clazz) {
//   return reservoir();
// }
// 
// Path: agera/src/test/java/com/google/android/agera/test/matchers/HasPrivateConstructor.java
// @NonNull
// @Factory
// public static Matcher<Class<?>> hasPrivateConstructor() {
//   return INSTANCE;
// }
// 
// Path: agera/src/test/java/com/google/android/agera/test/matchers/UpdatableUpdated.java
// @NonNull
// @Factory
// public static UpdatableUpdated wasNotUpdated() {
//   return WAS_NOT_UPDATED;
// }
// 
// Path: agera/src/test/java/com/google/android/agera/test/matchers/UpdatableUpdated.java
// @NonNull
// @Factory
// public static UpdatableUpdated wasUpdated() {
//   return WAS_UPDATED;
// }
// 
// Path: agera/src/test/java/com/google/android/agera/test/mocks/MockUpdatable.java
// @NonNull
// public static MockUpdatable mockUpdatable() {
//   return new MockUpdatable();
// }
// 
// Path: agera/src/test/java/com/google/android/agera/test/mocks/MockUpdatable.java
// public final class MockUpdatable implements Updatable {
//   private final List<Observable> observables;
// 
//   private boolean updated;
// 
//   private MockUpdatable() {
//     this.observables = new ArrayList<>();
//     this.updated = false;
//   }
// 
//   @NonNull
//   public static MockUpdatable mockUpdatable() {
//     return new MockUpdatable();
//   }
// 
//   @Override
//   public void update() {
//     updated = true;
//   }
// 
//   public boolean wasUpdated() {
//     runUiThreadTasksIncludingDelayedTasks();
//     return updated;
//   }
// 
//   public void resetUpdated() {
//     runUiThreadTasksIncludingDelayedTasks();
//     updated = false;
//   }
// 
//   public void addToObservable(@NonNull final Observable observable) {
//     observable.addUpdatable(this);
//     observables.add(observable);
//     runUiThreadTasksIncludingDelayedTasks();
//   }
// 
//   public void removeFromObservables() {
//     for (final Observable observable : observables) {
//       observable.removeUpdatable(this);
//     }
//     observables.clear();
//   }
// }


import static com.google.android.agera.Reservoirs.reservoir;
import static com.google.android.agera.Reservoirs.reservoirOf;
import static com.google.android.agera.test.matchers.HasPrivateConstructor.hasPrivateConstructor;
import static com.google.android.agera.test.matchers.ReservoirGives.givesAbsentValueOf;
import static com.google.android.agera.test.matchers.ReservoirGives.givesPresentValue;
import static com.google.android.agera.test.matchers.UpdatableUpdated.wasNotUpdated;
import static com.google.android.agera.test.matchers.UpdatableUpdated.wasUpdated;
import static com.google.android.agera.test.mocks.MockUpdatable.mockUpdatable;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.robolectric.Robolectric.flushForegroundThreadScheduler;
import static org.robolectric.annotation.Config.NONE;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.android.agera.test.mocks.MockUpdatable;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Queue;
import java.util.Set;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
  }

  @Test
  public void shouldUseCustomQueue() throws Exception {
    mockQueue.reject(INTEGER_1).prioritize(STRING_A);
    give(customQueueReservoir, INTEGER_2);
    give(customQueueReservoir, STRING_B);
    give(customQueueReservoir, INTEGER_1);
    give(customQueueReservoir, STRING_A);

    assertThat(customQueueReservoir, givesPresentValue((Object) STRING_A));
    assertThat(customQueueReservoir, givesPresentValue((Object) INTEGER_2));
    assertThat(customQueueReservoir, givesPresentValue((Object) STRING_B));
    assertThat(customQueueReservoir, givesAbsentValueOf(Object.class));
  }

  @Test
  public void shouldNotGetUpdateWhenCustomQueuePrioritizesAnotherValue() throws Exception {
    mockQueue.prioritize(INTEGER_2);
    updatable.addToObservable(customQueueReservoir);
    give(customQueueReservoir, INTEGER_1);
    updatable.resetUpdated();

    give(customQueueReservoir, INTEGER_2);

    assertThat(updatable, wasNotUpdated());
  }

  @Test
  public void shouldHavePrivateConstructor() {
// Path: agera/src/main/java/com/google/android/agera/Reservoirs.java
// @NonNull
// public static <T> Reservoir<T> reservoir() {
//   return reservoir(new ArrayDeque<T>());
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Reservoirs.java
// @NonNull
// public static <T> Reservoir<T> reservoirOf(
//     @SuppressWarnings("unused") @Nullable final Class<T> clazz) {
//   return reservoir();
// }
// 
// Path: agera/src/test/java/com/google/android/agera/test/matchers/HasPrivateConstructor.java
// @NonNull
// @Factory
// public static Matcher<Class<?>> hasPrivateConstructor() {
//   return INSTANCE;
// }
// 
// Path: agera/src/test/java/com/google/android/agera/test/matchers/UpdatableUpdated.java
// @NonNull
// @Factory
// public static UpdatableUpdated wasNotUpdated() {
//   return WAS_NOT_UPDATED;
// }
// 
// Path: agera/src/test/java/com/google/android/agera/test/matchers/UpdatableUpdated.java
// @NonNull
// @Factory
// public static UpdatableUpdated wasUpdated() {
//   return WAS_UPDATED;
// }
// 
// Path: agera/src/test/java/com/google/android/agera/test/mocks/MockUpdatable.java
// @NonNull
// public static MockUpdatable mockUpdatable() {
//   return new MockUpdatable();
// }
// 
// Path: agera/src/test/java/com/google/android/agera/test/mocks/MockUpdatable.java
// public final class MockUpdatable implements Updatable {
//   private final List<Observable> observables;
// 
//   private boolean updated;
// 
//   private MockUpdatable() {
//     this.observables = new ArrayList<>();
//     this.updated = false;
//   }
// 
//   @NonNull
//   public static MockUpdatable mockUpdatable() {
//     return new MockUpdatable();
//   }
// 
//   @Override
//   public void update() {
//     updated = true;
//   }
// 
//   public boolean wasUpdated() {
//     runUiThreadTasksIncludingDelayedTasks();
//     return updated;
//   }
// 
//   public void resetUpdated() {
//     runUiThreadTasksIncludingDelayedTasks();
//     updated = false;
//   }
// 
//   public void addToObservable(@NonNull final Observable observable) {
//     observable.addUpdatable(this);
//     observables.add(observable);
//     runUiThreadTasksIncludingDelayedTasks();
//   }
// 
//   public void removeFromObservables() {
//     for (final Observable observable : observables) {
//       observable.removeUpdatable(this);
//     }
//     observables.clear();
//   }
// }


// Path: agera/src/test/java/com/google/android/agera/ReservoirsTest.java
import static com.google.android.agera.Reservoirs.reservoir;
import static com.google.android.agera.Reservoirs.reservoirOf;
import static com.google.android.agera.test.matchers.HasPrivateConstructor.hasPrivateConstructor;
import static com.google.android.agera.test.matchers.ReservoirGives.givesAbsentValueOf;
import static com.google.android.agera.test.matchers.ReservoirGives.givesPresentValue;
import static com.google.android.agera.test.matchers.UpdatableUpdated.wasNotUpdated;
import static com.google.android.agera.test.matchers.UpdatableUpdated.wasUpdated;
import static com.google.android.agera.test.mocks.MockUpdatable.mockUpdatable;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.robolectric.Robolectric.flushForegroundThreadScheduler;
import static org.robolectric.annotation.Config.NONE;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import com.google.android.agera.test.mocks.MockUpdatable;
import java.util.ArrayDeque;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Queue;
import java.util.Set;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

  }

  @Test
  public void shouldUseCustomQueue() throws Exception {
    mockQueue.reject(INTEGER_1).prioritize(STRING_A);
    give(customQueueReservoir, INTEGER_2);
    give(customQueueReservoir, STRING_B);
    give(customQueueReservoir, INTEGER_1);
    give(customQueueReservoir, STRING_A);

    assertThat(customQueueReservoir, givesPresentValue((Object) STRING_A));
    assertThat(customQueueReservoir, givesPresentValue((Object) INTEGER_2));
    assertThat(customQueueReservoir, givesPresentValue((Object) STRING_B));
    assertThat(customQueueReservoir, givesAbsentValueOf(Object.class));
  }

  @Test
  public void shouldNotGetUpdateWhenCustomQueuePrioritizesAnotherValue() throws Exception {
    mockQueue.prioritize(INTEGER_2);
    updatable.addToObservable(customQueueReservoir);
    give(customQueueReservoir, INTEGER_1);
    updatable.resetUpdated();

    give(customQueueReservoir, INTEGER_2);

    assertThat(updatable, wasNotUpdated());
  }

  @Test
  public void shouldHavePrivateConstructor() {
    assertThat(Reservoirs.class, hasPrivateConstructor());