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

  @Test
  public void shouldReturnFunctionReturingEmptyListForFailureList() {
    assertThat(Functions.<Integer>resultListAsList().apply(FAILURE_LIST), is((empty())));
  }

  @Test
  public void shouldReturnFunctionReturningListWithValueForPresentWithList() {
    assertThat(Functions.<String>resultListAsList().apply(PRESENT_WITH_LIST), is(INPUT_LIST));
  }

  @Test
  public void shouldReturnFunctionReturningListWithValue() {
    assertThat(Functions.<Integer>itemAsList().apply(VALUE), contains(VALUE));
  }

  @Test
  public void shouldReturnObjectFromStaticFunction() {
    assertThat(staticFunction(INPUT_STRING).apply(new Object()), is(sameInstance(INPUT_STRING)));
  }

  @Test
  public void shouldReturnObjectFromSupplierForSupplierAsFunction() {
    assertThat(supplierAsFunction(mockSupplier).apply(new Object()),
        is(sameInstance(INPUT_STRING)));
  }

  @Test
  public void shouldReturnFromObject() {
// 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;

  }

  @Test
  public void shouldReturnFunctionReturingEmptyListForFailureList() {
    assertThat(Functions.<Integer>resultListAsList().apply(FAILURE_LIST), is((empty())));
  }

  @Test
  public void shouldReturnFunctionReturningListWithValueForPresentWithList() {
    assertThat(Functions.<String>resultListAsList().apply(PRESENT_WITH_LIST), is(INPUT_LIST));
  }

  @Test
  public void shouldReturnFunctionReturningListWithValue() {
    assertThat(Functions.<Integer>itemAsList().apply(VALUE), contains(VALUE));
  }

  @Test
  public void shouldReturnObjectFromStaticFunction() {
    assertThat(staticFunction(INPUT_STRING).apply(new Object()), is(sameInstance(INPUT_STRING)));
  }

  @Test
  public void shouldReturnObjectFromSupplierForSupplierAsFunction() {
    assertThat(supplierAsFunction(mockSupplier).apply(new Object()),
        is(sameInstance(INPUT_STRING)));
  }

  @Test
  public void shouldReturnFromObject() {
    assertThat(Functions.<String>identityFunction().apply(INPUT_STRING),