// 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;
/*
 * Copyright 2015 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.android.agera;



@Config(manifest = NONE)
@RunWith(RobolectricTestRunner.class)
public final class ReservoirsTest {
  private static final String STRING_A = "STRING_A";
  private static final String STRING_B = "STRING_B";
  private static final Integer INTEGER_1 = 1;
  private static final Integer INTEGER_2 = 2;

  private MockQueue mockQueue;
  private Reservoir<String> stringReservoir;
  private Reservoir<Integer> integerReservoir;
  private Reservoir<Object> customQueueReservoir;
  private MockUpdatable updatable;
  private MockUpdatable anotherUpdatable;

  @Before
  public void setUp() {
    mockQueue = new MockQueue();
    stringReservoir = reservoirOf(String.class);
    integerReservoir = reservoir();
    customQueueReservoir = reservoir(mockQueue);
// 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;

/*
 * Copyright 2015 Google Inc. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.android.agera;



@Config(manifest = NONE)
@RunWith(RobolectricTestRunner.class)
public final class ReservoirsTest {
  private static final String STRING_A = "STRING_A";
  private static final String STRING_B = "STRING_B";
  private static final Integer INTEGER_1 = 1;
  private static final Integer INTEGER_2 = 2;

  private MockQueue mockQueue;
  private Reservoir<String> stringReservoir;
  private Reservoir<Integer> integerReservoir;
  private Reservoir<Object> customQueueReservoir;
  private MockUpdatable updatable;
  private MockUpdatable anotherUpdatable;

  @Before
  public void setUp() {
    mockQueue = new MockQueue();
    stringReservoir = reservoirOf(String.class);
    integerReservoir = reservoir();
    customQueueReservoir = reservoir(mockQueue);
    updatable = mockUpdatable();