// Path: agera/src/main/java/com/google/android/agera/Conditions.java
// @NonNull
// public static Condition all(@NonNull final Condition... conditions) {
//   return composite(conditions, trueCondition(), falseCondition());
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Conditions.java
// @NonNull
// public static Condition any(@NonNull final Condition... conditions) {
//   return composite(conditions, falseCondition(), trueCondition());
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Conditions.java
// @NonNull
// public static Condition falseCondition() {
//   return FALSE_CONDICATE;
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Conditions.java
// @NonNull
// public static Condition not(@NonNull final Condition condition) {
//   if (condition instanceof NegatedCondition) {
//     return ((NegatedCondition) condition).condition;
//   }
//   if (condition == TRUE_CONDICATE) {
//     return FALSE_CONDICATE;
//   }
//   if (condition == FALSE_CONDICATE) {
//     return TRUE_CONDICATE;
//   }
//   return new NegatedCondition(condition);
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Conditions.java
// @NonNull
// public static <T> Condition predicateAsCondition(@NonNull final Predicate<T> predicate,
//     @NonNull final Supplier<? extends T> supplier) {
//   if (predicate == TRUE_CONDICATE) {
//     return TRUE_CONDICATE;
//   }
//   if (predicate == FALSE_CONDICATE) {
//     return FALSE_CONDICATE;
//   }
//   return new PredicateCondition<>(predicate, supplier);
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Conditions.java
// @NonNull
// public static Condition staticCondition(final boolean value) {
//   return value ? TRUE_CONDICATE : FALSE_CONDICATE;
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Conditions.java
// @NonNull
// public static Condition trueCondition() {
//   return TRUE_CONDICATE;
// }
// 
// 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/test/java/com/google/android/agera/test/matchers/ConditionApplies.java
// @NonNull
// @Factory
// public static Matcher<Condition> applies() {
//   return new ConditionApplies(true);
// }
// 
// Path: agera/src/test/java/com/google/android/agera/test/matchers/ConditionApplies.java
// @NonNull
// @Factory
// public static Matcher<Condition> doesNotApply() {
//   return new ConditionApplies(false);
// }
// 
// Path: agera/src/test/java/com/google/android/agera/test/matchers/HasPrivateConstructor.java
// @NonNull
// @Factory
// public static Matcher<Class<?>> hasPrivateConstructor() {
//   return INSTANCE;
// }


import static com.google.android.agera.Conditions.all;
import static com.google.android.agera.Conditions.any;
import static com.google.android.agera.Conditions.falseCondition;
import static com.google.android.agera.Conditions.not;
import static com.google.android.agera.Conditions.predicateAsCondition;
import static com.google.android.agera.Conditions.staticCondition;
import static com.google.android.agera.Conditions.trueCondition;
import static com.google.android.agera.Predicates.falsePredicate;
import static com.google.android.agera.Predicates.truePredicate;
import static com.google.android.agera.test.matchers.ConditionApplies.applies;
import static com.google.android.agera.test.matchers.ConditionApplies.doesNotApply;
import static com.google.android.agera.test.matchers.HasPrivateConstructor.hasPrivateConstructor;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.sameInstance;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
/*
 * 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;



public final class ConditionsTest {
  private static final int VALUE = 1;

  @Mock
  private Condition mockConditionFalse;
  @Mock
  private Condition mockConditionTrue;
  @Mock
  private Predicate<Integer> mockPredicateFalse;
  @Mock
  private Predicate<Integer> mockPredicateTrue;
  @Mock
  private Supplier<Integer> mockValueSupplier;

  @Before
  public void setUp() {
    initMocks(this);
    when(mockValueSupplier.get()).thenReturn(VALUE);
    when(mockConditionTrue.applies()).thenReturn(true);
    when(mockPredicateTrue.apply(anyInt())).thenReturn(true);
  }

  @Test
  public void shouldReturnTrueForTrueCondition() {
    assertThat(trueCondition(), applies());
  }

  @Test
  public void shouldReturnFalseForFalseCondition() {
// Path: agera/src/main/java/com/google/android/agera/Conditions.java
// @NonNull
// public static Condition all(@NonNull final Condition... conditions) {
//   return composite(conditions, trueCondition(), falseCondition());
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Conditions.java
// @NonNull
// public static Condition any(@NonNull final Condition... conditions) {
//   return composite(conditions, falseCondition(), trueCondition());
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Conditions.java
// @NonNull
// public static Condition falseCondition() {
//   return FALSE_CONDICATE;
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Conditions.java
// @NonNull
// public static Condition not(@NonNull final Condition condition) {
//   if (condition instanceof NegatedCondition) {
//     return ((NegatedCondition) condition).condition;
//   }
//   if (condition == TRUE_CONDICATE) {
//     return FALSE_CONDICATE;
//   }
//   if (condition == FALSE_CONDICATE) {
//     return TRUE_CONDICATE;
//   }
//   return new NegatedCondition(condition);
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Conditions.java
// @NonNull
// public static <T> Condition predicateAsCondition(@NonNull final Predicate<T> predicate,
//     @NonNull final Supplier<? extends T> supplier) {
//   if (predicate == TRUE_CONDICATE) {
//     return TRUE_CONDICATE;
//   }
//   if (predicate == FALSE_CONDICATE) {
//     return FALSE_CONDICATE;
//   }
//   return new PredicateCondition<>(predicate, supplier);
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Conditions.java
// @NonNull
// public static Condition staticCondition(final boolean value) {
//   return value ? TRUE_CONDICATE : FALSE_CONDICATE;
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Conditions.java
// @NonNull
// public static Condition trueCondition() {
//   return TRUE_CONDICATE;
// }
// 
// 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/test/java/com/google/android/agera/test/matchers/ConditionApplies.java
// @NonNull
// @Factory
// public static Matcher<Condition> applies() {
//   return new ConditionApplies(true);
// }
// 
// Path: agera/src/test/java/com/google/android/agera/test/matchers/ConditionApplies.java
// @NonNull
// @Factory
// public static Matcher<Condition> doesNotApply() {
//   return new ConditionApplies(false);
// }
// 
// 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/ConditionsTest.java
import static com.google.android.agera.Conditions.all;
import static com.google.android.agera.Conditions.any;
import static com.google.android.agera.Conditions.falseCondition;
import static com.google.android.agera.Conditions.not;
import static com.google.android.agera.Conditions.predicateAsCondition;
import static com.google.android.agera.Conditions.staticCondition;
import static com.google.android.agera.Conditions.trueCondition;
import static com.google.android.agera.Predicates.falsePredicate;
import static com.google.android.agera.Predicates.truePredicate;
import static com.google.android.agera.test.matchers.ConditionApplies.applies;
import static com.google.android.agera.test.matchers.ConditionApplies.doesNotApply;
import static com.google.android.agera.test.matchers.HasPrivateConstructor.hasPrivateConstructor;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.sameInstance;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;

/*
 * 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;



public final class ConditionsTest {
  private static final int VALUE = 1;

  @Mock
  private Condition mockConditionFalse;
  @Mock
  private Condition mockConditionTrue;
  @Mock
  private Predicate<Integer> mockPredicateFalse;
  @Mock
  private Predicate<Integer> mockPredicateTrue;
  @Mock
  private Supplier<Integer> mockValueSupplier;

  @Before
  public void setUp() {
    initMocks(this);
    when(mockValueSupplier.get()).thenReturn(VALUE);
    when(mockConditionTrue.applies()).thenReturn(true);
    when(mockPredicateTrue.apply(anyInt())).thenReturn(true);
  }

  @Test
  public void shouldReturnTrueForTrueCondition() {
    assertThat(trueCondition(), applies());
  }

  @Test
  public void shouldReturnFalseForFalseCondition() {
    assertThat(falseCondition(), doesNotApply());