// Path: agera/src/main/java/com/google/android/agera/Functions.java
// @NonNull
// public static <F, T> Function<F, T> staticFunction(@NonNull final T object) {
//   return new StaticProducer<>(object);
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Predicates.java
// @NonNull
// @SuppressWarnings("unchecked")
// public static <T> Predicate<T> falsePredicate() {
//   return FALSE_CONDICATE;
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Predicates.java
// @NonNull
// @SuppressWarnings("unchecked")
// public static <T> Predicate<T> truePredicate() {
//   return TRUE_CONDICATE;
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Repositories.java
// @NonNull
// public static <T> REventSource<T, T> repositoryWithInitialValue(@NonNull final T initialValue) {
//   return RepositoryCompiler.repositoryWithInitialValue(initialValue);
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Suppliers.java
// @NonNull
// public static <T> Supplier<T> staticSupplier(@NonNull final T object) {
//   return new StaticProducer<>(object);
// }
// 
// 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/SingleSlotDelayedExecutor.java
// public final class SingleSlotDelayedExecutor implements Executor {
//   @Nullable
//   private Runnable runnable;
// 
//   @Override
//   public void execute(@NonNull final Runnable command) {
//     assertThat("delayedExecutor cannot queue more than one Runnable", runnable, is(nullValue()));
//     runnable = command;
//   }
// 
//   public boolean hasRunnable() {
//     return runnable != null;
//   }
// 
//   public void resumeOrThrow() {
//     final Runnable runnable = this.runnable;
//     assertThat("delayedExecutor should have queued a Runnable for resumeOrThrow()",
//         runnable, is(notNullValue()));
//     this.runnable = null;
//     //noinspection ConstantConditions
//     runnable.run();
//   }
// }
// 
// 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.Functions.staticFunction;
import static com.google.android.agera.Predicates.falsePredicate;
import static com.google.android.agera.Predicates.truePredicate;
import static com.google.android.agera.Repositories.repositoryWithInitialValue;
import static com.google.android.agera.RepositoryConfig.CANCEL_FLOW;
import static com.google.android.agera.Suppliers.staticSupplier;
import static com.google.android.agera.test.mocks.MockUpdatable.mockUpdatable;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
import static org.robolectric.annotation.Config.NONE;
import com.google.android.agera.test.SingleSlotDelayedExecutor;
import com.google.android.agera.test.mocks.MockUpdatable;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
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 RepositoryDisposerTest {
  private static final Object INITIAL_VALUE = new Object();
  private static final Object FIRST_VALUE = new Object();
  private static final Object SECOND_VALUE = new Object();
  private static final Object BREAK_VALUE = new Object();
  private static final Object FINAL_VALUE = new Object();

  private MockUpdatable updatable;
// Path: agera/src/main/java/com/google/android/agera/Functions.java
// @NonNull
// public static <F, T> Function<F, T> staticFunction(@NonNull final T object) {
//   return new StaticProducer<>(object);
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Predicates.java
// @NonNull
// @SuppressWarnings("unchecked")
// public static <T> Predicate<T> falsePredicate() {
//   return FALSE_CONDICATE;
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Predicates.java
// @NonNull
// @SuppressWarnings("unchecked")
// public static <T> Predicate<T> truePredicate() {
//   return TRUE_CONDICATE;
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Repositories.java
// @NonNull
// public static <T> REventSource<T, T> repositoryWithInitialValue(@NonNull final T initialValue) {
//   return RepositoryCompiler.repositoryWithInitialValue(initialValue);
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Suppliers.java
// @NonNull
// public static <T> Supplier<T> staticSupplier(@NonNull final T object) {
//   return new StaticProducer<>(object);
// }
// 
// 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/SingleSlotDelayedExecutor.java
// public final class SingleSlotDelayedExecutor implements Executor {
//   @Nullable
//   private Runnable runnable;
// 
//   @Override
//   public void execute(@NonNull final Runnable command) {
//     assertThat("delayedExecutor cannot queue more than one Runnable", runnable, is(nullValue()));
//     runnable = command;
//   }
// 
//   public boolean hasRunnable() {
//     return runnable != null;
//   }
// 
//   public void resumeOrThrow() {
//     final Runnable runnable = this.runnable;
//     assertThat("delayedExecutor should have queued a Runnable for resumeOrThrow()",
//         runnable, is(notNullValue()));
//     this.runnable = null;
//     //noinspection ConstantConditions
//     runnable.run();
//   }
// }
// 
// 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/RepositoryDisposerTest.java
import static com.google.android.agera.Functions.staticFunction;
import static com.google.android.agera.Predicates.falsePredicate;
import static com.google.android.agera.Predicates.truePredicate;
import static com.google.android.agera.Repositories.repositoryWithInitialValue;
import static com.google.android.agera.RepositoryConfig.CANCEL_FLOW;
import static com.google.android.agera.Suppliers.staticSupplier;
import static com.google.android.agera.test.mocks.MockUpdatable.mockUpdatable;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
import static org.robolectric.annotation.Config.NONE;
import com.google.android.agera.test.SingleSlotDelayedExecutor;
import com.google.android.agera.test.mocks.MockUpdatable;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
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 RepositoryDisposerTest {
  private static final Object INITIAL_VALUE = new Object();
  private static final Object FIRST_VALUE = new Object();
  private static final Object SECOND_VALUE = new Object();
  private static final Object BREAK_VALUE = new Object();
  private static final Object FINAL_VALUE = new Object();

  private MockUpdatable updatable;
  private SingleSlotDelayedExecutor executor;