// Path: agera/src/main/java/com/google/android/agera/Functions.java
// @SuppressWarnings("unchecked")
// @NonNull
// public static <T> Function<Throwable, Result<T>> failedResult() {
//   return (Function<Throwable, Result<T>>) FAILED_RESULT;
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Functions.java
// @NonNull
// @SuppressWarnings({"unchecked", "UnusedParameters"})
// public static <F> FItem<F, F> functionFrom(@Nullable Class<F> from) {
//   return functionCompiler();
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Functions.java
// @NonNull
// @SuppressWarnings({"unchecked", "UnusedParameters"})
// public static <F> FList<F, List<F>, List<F>> functionFromListOf(
//     @Nullable final Class<F> from) {
//   return functionCompiler();
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Functions.java
// @NonNull
// public static <T> Function<T, T> identityFunction() {
//   @SuppressWarnings("unchecked")
//   final Function<T, T> identityFunction = (Function<T, T>) NULL_OPERATOR;
//   return identityFunction;
// }
// 
// 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/Functions.java
// @NonNull
// public static <F, T> Function<F, T> supplierAsFunction(
//     @NonNull final Supplier<? extends T> supplier) {
//   return new SupplierAsFunction<>(supplier);
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Result.java
// @SuppressWarnings("unchecked")
// @NonNull
// public static <T> Result<T> absent() {
//   return (Result<T>) ABSENT;
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Result.java
// @NonNull
// public static <T> Result<T> failure(@NonNull final Throwable failure) {
//   return failure == ABSENT_THROWABLE
//       ? Result.<T>absent() : new Result<T>(null, checkNotNull(failure));
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Result.java
// @NonNull
// public static <T> Result<T> present(@NonNull final T value) {
//   return success(value);
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Result.java
// @NonNull
// public static <T> Result<T> success(@NonNull final T value) {
//   return new Result<>(checkNotNull(value), null);
// }
// 
// 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.Functions.failedResult;
import static com.google.android.agera.Functions.functionFrom;
import static com.google.android.agera.Functions.functionFromListOf;
import static com.google.android.agera.Functions.identityFunction;
import static com.google.android.agera.Functions.staticFunction;
import static com.google.android.agera.Functions.supplierAsFunction;
import static com.google.android.agera.Result.absent;
import static com.google.android.agera.Result.failure;
import static com.google.android.agera.Result.present;
import static com.google.android.agera.Result.success;
import static com.google.android.agera.test.matchers.HasPrivateConstructor.hasPrivateConstructor;
import static java.util.Arrays.asList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.sameInstance;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
import android.support.annotation.NonNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.hamcrest.Matchers;
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 FunctionsTest {
  private static final int VALUE = 42;
  private static final int VALUE_PLUS_TWO = 44;
  private static final int RECOVER_VALUE = 43;
  private static final String INPUT_STRING = "input";
  private static final List<String> INPUT_LIST = asList("some", "strings", "for", "testing");
  @SuppressWarnings("ThrowableInstanceNeverThrown")
  private static final Throwable THROWABLE = new Throwable();
  private static final Result<Integer> FAILURE = failure(THROWABLE);
  private static final Result<Integer> RECOVER_SUCCESS = success(RECOVER_VALUE);
// Path: agera/src/main/java/com/google/android/agera/Functions.java
// @SuppressWarnings("unchecked")
// @NonNull
// public static <T> Function<Throwable, Result<T>> failedResult() {
//   return (Function<Throwable, Result<T>>) FAILED_RESULT;
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Functions.java
// @NonNull
// @SuppressWarnings({"unchecked", "UnusedParameters"})
// public static <F> FItem<F, F> functionFrom(@Nullable Class<F> from) {
//   return functionCompiler();
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Functions.java
// @NonNull
// @SuppressWarnings({"unchecked", "UnusedParameters"})
// public static <F> FList<F, List<F>, List<F>> functionFromListOf(
//     @Nullable final Class<F> from) {
//   return functionCompiler();
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Functions.java
// @NonNull
// public static <T> Function<T, T> identityFunction() {
//   @SuppressWarnings("unchecked")
//   final Function<T, T> identityFunction = (Function<T, T>) NULL_OPERATOR;
//   return identityFunction;
// }
// 
// 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/Functions.java
// @NonNull
// public static <F, T> Function<F, T> supplierAsFunction(
//     @NonNull final Supplier<? extends T> supplier) {
//   return new SupplierAsFunction<>(supplier);
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Result.java
// @SuppressWarnings("unchecked")
// @NonNull
// public static <T> Result<T> absent() {
//   return (Result<T>) ABSENT;
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Result.java
// @NonNull
// public static <T> Result<T> failure(@NonNull final Throwable failure) {
//   return failure == ABSENT_THROWABLE
//       ? Result.<T>absent() : new Result<T>(null, checkNotNull(failure));
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Result.java
// @NonNull
// public static <T> Result<T> present(@NonNull final T value) {
//   return success(value);
// }
// 
// Path: agera/src/main/java/com/google/android/agera/Result.java
// @NonNull
// public static <T> Result<T> success(@NonNull final T value) {
//   return new Result<>(checkNotNull(value), null);
// }
// 
// 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/FunctionsTest.java
import static com.google.android.agera.Functions.failedResult;
import static com.google.android.agera.Functions.functionFrom;
import static com.google.android.agera.Functions.functionFromListOf;
import static com.google.android.agera.Functions.identityFunction;
import static com.google.android.agera.Functions.staticFunction;
import static com.google.android.agera.Functions.supplierAsFunction;
import static com.google.android.agera.Result.absent;
import static com.google.android.agera.Result.failure;
import static com.google.android.agera.Result.present;
import static com.google.android.agera.Result.success;
import static com.google.android.agera.test.matchers.HasPrivateConstructor.hasPrivateConstructor;
import static java.util.Arrays.asList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.sameInstance;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import static org.mockito.MockitoAnnotations.initMocks;
import android.support.annotation.NonNull;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.hamcrest.Matchers;
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 FunctionsTest {
  private static final int VALUE = 42;
  private static final int VALUE_PLUS_TWO = 44;
  private static final int RECOVER_VALUE = 43;
  private static final String INPUT_STRING = "input";
  private static final List<String> INPUT_LIST = asList("some", "strings", "for", "testing");
  @SuppressWarnings("ThrowableInstanceNeverThrown")
  private static final Throwable THROWABLE = new Throwable();
  private static final Result<Integer> FAILURE = failure(THROWABLE);
  private static final Result<Integer> RECOVER_SUCCESS = success(RECOVER_VALUE);
  private static final Result<Integer> PRESENT_WITH_VALUE = present(VALUE);